Centos MySQL 忘记密码怎么办

 2387

centos mysql忘记密码的解决办法:1、在[mysqld]的段中加上一句“skip-grant-tables”;2、重启mysql服务;3、输入“mysql -u root -p”;4、通过update修改密码即可。

Centos MySQL 忘记密码怎么办

centos系统mysql忘记密码

安装 mysql 之后,注意添加软连接

mysql 忘记密码操作:

vim /etc/my.cnf

在 [mysqld] 的段中加上一句:

skip-grant-tables

重启 mysql 服务, service mysql restart

在输入 mysql -u root -p 输入回车即可进入 mysql 数据库

use mysql;

低版本修改:

update user set Password = password('LDtianzhe.') where user = 'root';

高版本修改:

update user set authentication_string=password('new password') where user = 'root';

再次vim /etc/my.cnf 注释掉 上面添加的重启服务即可再次进入数据库

如果出现此错误:

ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

需要关闭保护模式


Centos MySQL 忘记密码怎么办


再次使用更新密码即可


Centos MySQL 忘记密码怎么办


退出,注释掉 skip-grant-tables

重启服务即可


本文网址:https://www.zztuku.com/detail-10229.html
站长图库 - Centos MySQL 忘记密码怎么办
申明:如有侵犯,请 联系我们 删除。

评论(0)条

您还没有登录,请 登录 后发表评论!

提示:请勿发布广告垃圾评论,否则封号处理!!

    编辑推荐