Can't connect to remote server using MySQL Workbench on mac

放肆的年华 提交于 2019-12-14 01:29:01

问题


I'm trying to connect to a remote database but it gives me an error that the password is wrong:

Connecting to MySQL server www.test.net... Access denied for user 'test'@'test' (using password: YES)

I know that the password is correct, as I can access to the cpanel with it, but it always gives me the same error, I even tried to change the user to one of the users on that database, but nothing seems to work

Answer

It seem this question gets a lot of viewers, so I might as well tell you what solved the problem for me:

I had to give permission to my IP from the server, so that my PC would be recognized as safe to access the DB


回答1:


Does the database allow access to the user test from the IP you are making the call to?

In the users table you specify a host from which this user can access the database. Often this may default to localhost or 127.0.0.1




回答2:


Allow access from all machines :

mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Allow access from Machine which ip = x.y.z.t

mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'x.y.z.t' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Example :

 GRANT ALL PRIVILEGES ON *.* TO 'admin'@'172.16.10.34' IDENTIFIED BY 'myp@$$word' WITH GRANT OPTION;



回答3:


To allow the user to make the call, you need to do

GRANT ALL PRIVILEGES ON *.* TO test@xxx.xxx.xxx.xxx



来源:https://stackoverflow.com/questions/18400987/cant-connect-to-remote-server-using-mysql-workbench-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!