mysql-1045(28000)錯誤


說明:win7系統,已經裝過一個安裝版的mysql(服務沒有啟動),然后又安裝了一個免安裝版的mysql,然后啟動該免安裝版的mysql后,用root用戶無法登陸(因為想着root用戶默認密碼是空,但是卻無法登陸),如下所示:

D:\>cd D:\MySQL Server 5.1\bin

D:\MySQL Server 5.1\bin>mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

解決辦法:
D:\MySQL Server 5.1\bin>mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

將密碼重新設置(設為空)
mysql> set password for 'root'@localhost=password('');
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

再次以root用戶(密碼為空)則可以登陸:
D:\MySQL Server 5.1\bin>mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

我想出現這個原因,估計是因為我之前裝的這個mysql,root用戶密碼修改了,不是非空了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM