zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

linux 下忘记 mysql登陆密码解决方法详解数据库

mysqlLinux数据库方法 详解 解决 忘记 登陆密码
2023-06-13 09:20:08 时间

1、修改my.conf配置文件,添加 skip-grant-tables ,保存并退出,systenctl restart mysqld.service  命令重启服务

2、登陆mysql数据库(直接输入mysql即可),修改登陆用户的密码alter user [email protected](如 [email protected]) identified by new_password

或 update mysql.user set authentication_string=password( NewPassword ) where user= root

3、使用 flush privileges ; 写入命令

注:执行完步骤“2”会报错“ERROR 1290 (HY000): The MySQL server is running with the skip-grant-tables option so it cannot execute this statement” ,直接忽略执行步骤3即可

4、修改my.conf配置文件,去掉 skip-grant-tables 并重新启动mysqld服务

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/3859.html

mysql