mysql忘记密码:
1、修改主配置文件,添加–skip–grant–tables
vim /etc/my.cnf[mysql]skip-grant-tables
2、重启mysqld
systemctl restart mysqld
3、无需输入密码进入mysql,执行修改密码指令,刷新并退出
mysql -u root -p //回车进入数据库,无需输入密码mysql>update user set authentication_string=password(\"123456\") where User=\"root\";mysql>flush priviliges //刷新mysql>alter user user() identified by \"123456\"mysql>quit
4、恢复主配置文件,重启mysqld