当前位置:Gxlcms > 数据库问题 > 忘记MySQL密码,如何破?

忘记MySQL密码,如何破?

时间:2021-07-01 10:21:17 帮助过:21人阅读

--user=mysql &

现在可以使用mysql命令登陆了

mysql -uroot

然后就可以改密码了

update mysql.user set password=password("password") where user=‘root‘ and host=‘localhost‘;


2.多实例情况

先将数据库停掉,然后使用如下命令启动数据库

/bin/sh /app/mysql/bin/mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-tables --user=mysql &

登陆

mysql -uroot -S mysql.sock

然后就可以改密码了

mysql>update mysql.user set password=password("password") where user=‘root‘ and host=‘localhost‘;

mysql>flush privileges;

本文出自 “老暖男的博客” 博客,请务必保留此出处http://ashine.blog.51cto.com/1632639/1654067

忘记MySQL密码,如何破?

标签:mysql

人气教程排行