mysql for linux 密码找回
? mysql ? ? linux ? ? 密码 ? ? 忘记 ?    324    0    0

打开配置文件添加如下内容:skip-grant-tables

vi /etc/my.cnf 

skip-grant-tables 

例如:
[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
skip-grant-tables 

 

登陆mysql修改密码:

mysql>use mysql;

mysql>update user set password=password("mysql") where user='root';

mysql>update user set authentication_string=password("mysql") where user='root';

mysqlflush privileges;

退出数据库重启即可。

觉得不错,点个赞?
Sign in to leave a comment.
No Leanote account ? Sign up now.
0 条评论
文章目录