rd42
rd42

Reputation: 3594

Connect to remote mysql via terminal

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)

Any ideas

Upvotes: 10

Views: 43007

Answers (3)

Robert Holland
Robert Holland

Reputation: 31

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

Upvotes: 3

nos
nos

Reputation: 229284

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)

Upvotes: 19

devasia2112
devasia2112

Reputation: 6034

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.

Upvotes: 3

Related Questions