欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

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

程序员文章站 2022-04-15 21:22:32
[TOC] 1.开启跳过权限验证 2.重置密码 ......

目录

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