Linux 下忘了mysql的root密碼
1.關閉mysql服務/etc/init.d/mysqld stopservice mysqld stop
2.使用–skip-grant-tables選項啟動MySQL服務,可以修改/etc/inin.d/mysqld腳本啟動位置增加此選項
mysqld_safe –skip-grant-tables & #馬上會出現下面這個提示,為了進入mysql,
你可以用Ctrl+C結束或者重新打開一個終端[root@Blinux ~]# Starting mysqld daemon with databases from /var/lib/mysql
3.修改root用戶的密碼[root@~]# mysql -u rootmysql> use mysql;mysql> update user set password=password("123456") where user="root";mysql> flush privileges;mysql> exit(123456)就是要改的密碼
4.重新啟動MySQL/etc/init.d/mysqld restartservice mysqld restart
5.用新密碼登入 登入方式有兩種1.mysql -uroot -p123456 2.[root@home ~]# mysql -u root -p Enter password:123456
If you could e-mail me with a few suggestions on just how you made your blog look this excellent, I would be grateful.