数据库
首页 > 数据库> > MySQL5.7没有初始密码解决办法

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';

标签:解决办法,vi,MySQL5.7,etc,init,初始密码,mysqld,root,restart
来源: https://www.cnblogs.com/yanyanqaq/p/12801710.html