-
编辑文件 :vim /etc/my.cnf
-
找到文件位置:[Mysqld]
-
加入忽略密码登录的设置: skip-grant-tables
-
保存退出: :wq!
-
重启mysql:systemctl restart mysqld.service
- 进入mysql :mysql -u root -p
-
修改root密码: update mysql.user set authentication_string=password('123456') where User="root" and Host="localhost";
-
、刷新系统授权表: flush privileges
-
配置登录信息: grant all on *.* to 'root'@'localhost' identified by '123456' with grant option;
-
取消跳过 :注销:vim /etc/my.cnf下的----[Mysqld] ----skip-grant-tables
Linux系统忘记mysql密码解决办法
最新推荐文章于 2024-05-20 17:15:16 发布