昨天把密碼給忘了 網(wǎng)上找了一番找到了一個好辦法! 無 linux下忘記了mysql的root用戶密碼解決辦法: 一、以系統(tǒng)的root用戶(什么,你的系統(tǒng)的root用戶密碼也忘了。那只好看我另外一篇linux下忘記root用戶的解決辦法了先解決這個問題)登陸系統(tǒng),進入終端 [roo
昨天把密碼給忘了 網(wǎng)上找了一番找到了一個好辦法! <無> $velocityCount-->linux下忘記了mysql的root用戶密碼解決辦法: 一、以系統(tǒng)的root用戶(什么,你的系統(tǒng)的root用戶密碼也忘了。那只好看我另外一篇linux下忘記root用戶的解決辦法了先解決這個問題)登陸系統(tǒng),進入終端 [root@localhost /]# 二、殺掉mysql進程 方法1、[root@localhost /]#killall mysqld 方法2、[root@localhost /]#ps -aux //查看所有進程,找到mysql進程的pid 然后 [root@localhost /]#kill pid //pid是mysql的進程號 三、用--skip-grant-tables參數(shù)啟動mysqld [root@localhost /]#/usr/local/mysql/bin/mysqld_safe --skip-grant-tables& // 其中/usr..../bin是我的mysql安裝目錄 [root@localhost /]#/usr/local/mysql/bin/mysql //進入mysql mysql> use mysql //切換到mysql database mysql> UPDATE user SET password=password('123456') WHERE user='root'; //將root密碼該為123456了 四、注意事項 The full command to load MySQL like this is: mysqld_safe --skip-grant-tables --autoclose (Editor's Note: Our technical reviewer found that he had to launch the mysqld_safe command without the '--autoclose' flag, otherwise the daemon never started.) 這是國外網(wǎng)站說的,我沒用autoclosa也成功了 但是我在執(zhí)行/usr/local/mysql/bin/mysqld_safe --skip-grant-tables&即出現(xiàn)錯誤提示: ./mysqld_safe starting mysqld daemon with databases from /usr/local/var STOPPING server from pid file /usr/local/var/localhost.localdomain.pid mysqld ended 然后進入/usr/local/var/ vi ./localhost.localdomain.err 內(nèi)容如下: 050410 04:02:59 mysqld started 050410 4:03:00 InnoDB:Operating system error number 13 in a file operation. InnoDB:The error means mysqld does not have the access rights to InnoDB:the directory. InnoDB:File name ./ibdata1 InnoDB:File operation call:'create'. InnoDB:Cannot continue operation. 050410 04:03:00 mysqld ended 懷疑是./var目錄的訪問權(quán)限,故如下操作: chmod 777 ./var 然后重新執(zhí)行后臺,仍出以上錯誤,但在localhost.localdomain.err文件中的錯誤信息已改為找不到一個叫做 help.*的文件了(這個文件名我記不得了) 這是因為我的mysql安裝目錄的讀寫權(quán)限是這樣造成的 mysql安裝目錄屬于用戶root,但是群組是mysql的 把群組也改為root即可。
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com