开发者

Connect to remote mysql via terminal

开发者 https://www.devze.com 2023-02-17 05:51 出处:网络
For a test I set up user mysql user with % access.When I try to connect from a remote machine I get: Enter password:

For a test I set up user mysql user with % access. When I try to connect from a remote machine I get:

Enter password:

Then immediately get this:

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘xxxxxxx’ (1)

An开发者_如何学Goy ideas


Verify that you can connect to the mysql port with telnet from that remote machine, e.g.

telnet 192.168.1.52 3306

If that fails, there's a firewall somewhere preventing you to connect, or you're running mysql on a different port than the default(3306) or mysql isn't configured to listen on the interface/ip address (maybe it's just configured to listen on connections from localhost, check the bind-address configuration in the my.cnf config file)


Try to comment the bind-address = 127.0.0.1 in your /etc/mysql/my.cnf

# security:
# using "localhost" in connects uses sockets by default
# skip-networking
# bind-address = 127.0.0.1  --- commented

and watch the results. If not work try to use the IP address and if still not work. roll back the original file.


Can you telnet to the MySQL port 3306? If you can't then check to make sure the MySQL server service is listening on that port. Open a command prompt and type the following example. Example: telnet yourmysqlservername.com 3306

0

精彩评论

暂无评论...
验证码 换一张
取 消