0

Good afternoon everyone.

I have 3 servers on 2 different networks, all of which run MySQL.

I can use mysql -u<user> -p -h<ip-addr> from server 1 to server 2 and back without a problem.

When I try to use that command from server 3 (which is on a differnet network) to server 1 I get the following:-

$ mysql -u<user> -p -h<hostIP>
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '<hostIP>' (146)
$

I know the same command works from server 2 to server 1 with the same password. My initial thought was that there was a network block between server 3 and server 1 but if that were the case then server 3 would not get a password prompt.

I have also looked at the users table in server 1 and the user has the same password for local connections and network connections (which is why it works from server 2 to server 1).

Is there another port other than 3306 that is used as part of the connection after that password prompt? Or, failing that, what am I missing?

Many thanks,

David

0

There could be multiple reasons for this but to start troubleshooting as it looks like the issue with permissions/grants.

1.Please check and assign proper grants on server 1 :

GRANT ALL PRIVILEGES ON db.* TO 'username'@'server3_ip' IDENTIFIED BY 'Password';

flush privileges;

All is not compulsory in above query.

2.Double Check Bind parameter in in My.cnf .

bind-address 0.0.0.0

Hope this helps else we can debug further.

  • Looks like it was a privileges as the first command resolved my problem. Not sure why it was working from server 2 to server 1 though as there was no specific entry for user @ server 2 in the user table. – David Aug 2 '16 at 14:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.