天天看點

mysql安裝問題 The security setting could not be applied to the database 解決辦法

轉載[url]http://www.onlycto.com/tech/1000/61.html[/url]

[quote]相信有朋友遇到過這個問題,特别是不是第一次安裝mysql的朋友。

說明:我所說的都是在windowsXP系統下的mysql問題

問題描述一般是

“The security setting could not be applied to the database because the connection has

failed with the following error”

網上的辦法一般是

1、将原來的mysql解除安裝掉,然後把安裝目錄手動清除

2、在系統資料庫中查詢mysql,删除系統資料庫資訊

3、将3306(mysql端口)在防火牆中放行

以上兩步,如果能解決問題最好了,你可以試試[/quote]。

我的系統是win7,沒成功,我是用下面的方法解決的

[quote]不過,我的問題還是通過下面的辦法解決。

重要提示:如果你的mysql服務總是無法啟動,則在安裝的時候,将mysql服務換個名稱,比如 mysql501

1. 如果你的mysql執行個體配置向導失敗了,取消此向導,進入到 windows系統的 服務界面(通過在 運作 中 錄入 services.msc ,然後回車可進入服務界面),将mysql服務停止

2. 再次執行mysql執行個體向導(此時mysql服務應該啟動了)

—可通過 開始->mysql ->執行個體配置向導 打開執行個體配置向導

3.如果第4步失敗(Apply Security Settings),取消此向導

4. 建立一個 txt檔案 (例如 C:\mysqlpassword.txt)),檔案内容如下:

UPDATE mysql.user SET Password=PASSWORD(’mypassword’) WHERE User=’root’;

FLUSH PRIVILEGES;

5.打開指令行視窗并且執行如下指令

“C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld” –defaults-file=”C:\Program Files\MySQL\MySQL Server 5.1\my.ini” –init-file=C:\mysqlpassword.txt –standalone –console

執行完後,保持視窗不關閉

6.打開另外一個指令行視窗,執行如下指令

“C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin” -u root -p shutdown

(輸入在 mysqlpassword.txt 中指定的密碼)

7、再次執行 mysql 執行個體配置向導,Apply Security Settings應該能成功了

祝你好運!

此辦法是從此http://bugs.mysql.com/bug.php?id=18555找到的[/quote]

雖然執行第6步時報錯了,但是不影響,直接進行第7步即可

錯誤是

C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqladmin: connect to server at 'lo
calhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'