如果 MySQL 正在运行,首先杀之: killall -TERM mysqld。
启动 MySQL :bin/safe_mysqld --skip-grant-tables &
就可以不需要密码就进入 MySQL 了。
然后就是
mysql>use mysql
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
重新杀 MySQL ,用正常方法启动 MySQL
启动 MySQL :bin/safe_mysqld --skip-grant-tables &
就可以不需要密码就进入 MySQL 了。
然后就是
mysql>use mysql
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
重新杀 MySQL ,用正常方法启动 MySQL
本文介绍了一种无需密码进入MySQL的方法,并提供了更新root用户密码的具体步骤。通过终止MySQL进程,使用特定参数启动MySQL服务,可以绕过密码验证。之后在MySQL内部执行SQL语句更新root用户的密码。
1036

被折叠的 条评论
为什么被折叠?



