MySQL5.7没有初始密码解决办法

Posted 黄海彦架构师之路

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL5.7没有初始密码解决办法相关的知识,希望对你有一定的参考价值。

1.开启跳过权限验证

vi /etc/my.cnf
[mysqld]
skip-grant-tables

/etc/init.d/mysqld restart

2.重置密码

use mysql;
update user set authentication_string=password(‘123456‘) where user=‘root‘ and host=‘localhost‘;
flush privileges;

/etc/init.d/mysqld restart

vi /etc/my.cnf
[mysqld]
skip-grant-tables    #delete

/etc/init.d/mysqld restart

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456‘;

以上是关于MySQL5.7没有初始密码解决办法的主要内容,如果未能解决你的问题,请参考以下文章