I have a cloud based application in PHP with one master server and multiple slaves. All servers are using master's database (mysql).

I already done this steps

CREATE USER 'mysql'@'%' IDENTIFIED BY 'my_secret_password';

Also I commented "skip-external-locking" and "bind-address" from my.cnf

The connection from my Mac works and it also works from each slave server. On the master server I'm using the same config as on the slave servers, but it doesn't work.

Host: master.myapp.com
Port: 9999
User: mysql

Any ideas?

  • 2
    What is the error you have got?
    – cuonglm
    May 15 '13 at 8:58
  • PHP PDO returned: SQLSTATE[28000] [1045] Access denied for user 'mysql'@'master.myapp.com' (using password: YES) May 15 '13 at 8:59
  • mysql client (mysql -h master.myapp.com) returned: ERROR 2003 (HY000): Can't connect to MySQL server on 'master.myapp.com' (111) May 15 '13 at 9:00
  • Does master.myapp.com resolve differently on the local machine? Does the address point to the local machine or a port-forwarder? Is there a reason you don't use localhost (filesystem socket)?
    – symcbean
    May 15 '13 at 9:00
  • The 2 errors reported above indicate different failure scenarios.
    – symcbean
    May 15 '13 at 9:01

The problem was that I had ''@'master.myapp.com (anonymous user). This answer solved my issue: https://stackoverflow.com/a/11216911/1630391

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.