mysql忘记密码
使用源码安装的MySQL忘掉密码
关闭mysql服务
修改/etc/my.cnf
,设置免密登陆mysql
#vim /etc/my.cnf
[mysqld]
skip_grant_tables
启动mysql
#systemctl start mysql
更新密码
# mysql -u
mysql> update mysql.user set authentication_string=PASSWORD('123456') where user='root';
mysql> flush privileges;
exit
关闭免密登陆,注释(删除)掉/etc/my.cnf
中skip_grant_tables
#systemctl stop mysql
#vim /etc/my.cnf
#systemctl start mysql
# mysql -uroot -p123456