如果 MySQL 正在运行,首先杀之: killall -TERM MySQLd。
启动 MySQL :bin/safe_MySQLd --skip-grant-tables &
就可以不需要密码就进入 MySQL 了。
然后就是
>use MySQL
>update user set passwordpassword=password("new_pass") where user="root";
>flush privileges;
- >use MySQL
- >update user set passwordpassword=password("new_pass") where user="root";
- >flush privileges;
复制代码
重新杀 MySQL ,用正常方法启动 MySQL 。
如果 MySQL 正在运行,首先杀之: killall -TERM MySQLd。
启动 MySQL :bin/safe_MySQLd --skip-grant-tables & (有时会是MySQLd_safe)
就可以不需要密码就进入 MySQL 了。
然后就是 /usr/local/MySQL/bin/MySQL
- >use MySQL
- >update user set passwordpassword=password("new_pass") where user="root";
- >flush privileges;
复制代码
重新杀 MySQL ,用正常方法启动 MySQL 。
以上的相关内容就是对MySQL忘记root的介绍,望你能有所收获。
最新评论