Connecting to a remote mysql server from a windows machine (XP)

I am trying to connect to mysql server which is installed on my home pc from another pc. I allowed all connection in mysql configuration. There's no firewall blocking on the pc I am trying to connect from. I used the command-

mysql -h Some.Host.IP -u SomeUser -p SomePassword

I am getting-

ERROR 2003 (HY000): Can't connect to MySQL server on 'Some.Host.IP' (10060)

I can connect through php!!

What's the problem? How do I solve it?

4

5 Answers

If PHP and MySQL are running on the same server you might want to check if the bind-address option in the MySQL config file (it's probably called my.ini on Windows machines) is actually turned off:

#bind-address = 127.0.0.1

That option can be easily overlooked and needs to be off to allow incoming connections.

Is the user you are using allowed in MySQL to connect from the client you are using (or %)? If you are running php on the same server as MySQL, php will connect from localhost, needing only access from localhost but to access with mysql command, you need your machine / user combination to be allowed.

As in other answers, look for #bind-address = 127.0.0.1 in my.cfg or my.ini in windows directory and be sure it is commented or = 0.0.0.0 (for all interfaces) or = your server LAN IP depending on your needs.

Is there a firewall at the machine where you are running the mysql server? And if you are trying to connect from outside you local network, you should forward the ports u are using to connect to you mysql server in your router/modem.

Do you have firewall exception rule on your server?

And just like mention in previous reply are you connecting on same network or from different network?

I think there should be no space after -p option.

-p SomePassword

-pSomePassword

Your syntax should ask for the password and connect to db SomePassword.

Try like this mysql -h Some.Host.IP -u SomeUser -pSomePassword SomeDatabase

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like