I installed apache server (this story). I cannot connect with remote (I tried local too) mysql server. After a long loading page I get error MySQL database connect failure. Mysql server is far from me. On same page which locate in Internet with same settings is good work. How to solve this?

When I typed in terminal:

mysql -u username -h x.xx.xx.x -p

After a minute I get:

ERROR 2003 (HY000): Can't connect to MySQL server on 'xxxxxxxxx' (110)

I cannot visit localhost/phpadmin/, because I get 403 error. I doubt the correctness of the phpadmin settings...

  • what is the URL are you trying to access to your server. you'll need phpmyadmin to access the database. If I'm not mistakn, lamp has it all with pack. Try, http://localhost/phpmyadmin
    – AzkerM
    Apr 16, 2014 at 18:49

3 Answers 3


How are you connecting to the database, if it is with php try

mysql_connect("localhost", username, password);

with localhost as your host.


Open up your terminal or console and type the following:

mysql -u username -h x.xx.xx.x -p

then enter your password

This gives you the assurance that the connection from your host it works, and if not, return a useful error output.


I think you should allow IP or port 3306 on firewal and grant permission for user@IP for local visit with command:

sudo ufw allow from IP/subnet to any port 22
  • Grant permission user connect from remote on Mysql:

    GRANT ALL PRIVILEGES ON *.* TO root@'IP' IDENTIFIED BY 'password' with grant option;

    flush privileges;

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.