MYSQL忘了ROOT密码
MYSQL忘了ROOT密码 UNIX版 1.先停掉mysql
/etc/rc.d/init.d/mysql stop
2.以--skip-grant-table 的參數啟動mysql
mysql_safe --skip-grant-table&
- 更改root 密碼 123456
mysql mysql
mysql> UPDATE user SET password=password('123456') WHERE user='root'; mysql> FLUSH PRIVILEGES; mysql> exit 4.停掉mysql再重跑 killall mysqld #/etc/rc.d/init.d/mysqld
mysql -u root -p
Enter password: Windows版 首先,停止Mysql服务(net stop mysql),是必须的 shell>mysqld-nt --skip-grant 不要关闭此窗口,然后打开新的CMD窗口
shell>mysql mysql>use mysql mysql>update user set password=password('newpassword') where user='root'; mysql>q shell> 关闭mysqld-nt --skip-grant这个CMD窗口 启动Mysql服务即可。
关闭mysqld-nt --skip-grant窗口后,Mysql服务并没停止 杀掉进程中的mysqld-nt进程后,重启mysql即可。