Mysql忘记密码,修改密码
vim /etc/my.cnf
- 在 [mysqld] 中加上一行跳过权限限制
skip-grant-tables
service mysqld restart
mysql -uroot -p
(直接点击回车,密码为空)use mysql;
mysql> update user set password=password('123') where user='root';
//5.6mysql> update user set authentication_string=password('new password') where user='root';
//5.7mysql> flush privileges;
退出mysql 删除
skip-grant-tables
service mysqld restart