I use MySQL within my application and I just tried to connect to my local MySQL server. First I tried to connect using the right connection details (localhost, user: root, no password). It succeeds. Then I tried to connect using the wrong connection details (localhost, user: root1, password: 123). It failed. But if i leave the password blank then it succeeds? I dont know why but everytime i leave the password blank and only provide a username (whatever username you can imagine) it succeeds! Can anyone help me with this crazy error? Dont know why the server doesn't reject my connection attempt.
我在我的应用程序中使用MySQL,我只是尝试连接到我的本地MySQL服务器。首先,我尝试使用正确的连接详细信息进行连接(localhost,用户:root,无密码)。它成功了。然后我尝试使用错误的连接细节进行连接(localhost,用户:root1,密码:123)。它失败了。但是,如果我将密码留空,那么它会成功吗?我不知道为什么,但每次我把密码留空并只提供一个用户名(你可以想象的任何用户名)它成功!谁能帮我解决这个疯狂的错误?不知道为什么服务器不拒绝我的连接尝试。
Thanks in advance!
提前致谢!
1 个解决方案
#1
3
I would suggest you to changed the root password to something it hasn't been before. Then, FLUSH PRIVILEGES. Problem solved. You won't be able to log in locally with a blank password (same through PhpMyAdmin).
我建议你将root密码更改为以前没有的密码。然后,FLUSH特权。问题解决了。您将无法使用空白密码在本地登录(通过PhpMyAdmin相同)。
For more details, you can visit this link: http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html
有关更多详细信息,请访问此链接:http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html
#1
3
I would suggest you to changed the root password to something it hasn't been before. Then, FLUSH PRIVILEGES. Problem solved. You won't be able to log in locally with a blank password (same through PhpMyAdmin).
我建议你将root密码更改为以前没有的密码。然后,FLUSH特权。问题解决了。您将无法使用空白密码在本地登录(通过PhpMyAdmin相同)。
For more details, you can visit this link: http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html
有关更多详细信息,请访问此链接:http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html