Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am installing a MySql server in Ubuntu desktop. I could connect MySql Query Browser to it when specifying the Server Hostname as localhost, but when I replace it by the machine's IP it stops working (even if the MySql Query Browser runs in the same machine).

All I have done so far is removing the iptables, but it seems it have nothing to do with it.

Here is the error message

Could not connect to host ''.

MySQL Error Nr. 2003

Can't connect to MySQL server on '' (111)

Click the 'Ping' button to see if there is a networking problem.

The ping is ok, though

share|improve this question
up vote 21 down vote accepted

You'll have to bind your mysqld to a IP different from

Open your my.cnf (/etc/mysql/my.cnf usually) and change the line that says

bind =

to whatever IP your machine uses to connect to the outside world. binds to all IP addresses. Don't forget to restart your mysqld after that change.

share|improve this answer
got a different error now: Could not connect to host ''. MySQL Error Nr. 1130 Host 'whatever-vubuntu.local' is not allowed to connect to this MySQL server – Jader Dias Dec 6 '09 at 16:56
user@localhost and user@<hostname> is different. You have to add the user to be able to connect from remote hosts. – James Dec 6 '09 at 17:07
This is not the problem. I've done this and I still get the error. – Cerin Jun 4 '13 at 22:37
Should that be bind-address? – Thomas Jul 1 '15 at 13:22

In addition to halfdan answer I had to execute the following mysql command:

ON databasename.*
TO 'username'@'clientipaddress'
IDENTIFIED BY 'password'

As I learned on,23619,41248#msg-41248

share|improve this answer

Several more potential problems explained here:

If you want to grant all privileges to all databases, try

grant all on *.* to 'joe'@'%';

However, before you do that, make sure you have a user in the "mysql" database that has "Host" set to your IP address--in my case, my IP here at home. So user "joe" may have more than one record, one for each IP he might be calling from. To see what you have in there already:

use mysql;
select Host, User, Password from user where user='joe';`

In my case, turned out my user now had the correct IP but the password was also missing. I cut-pasted the password (it's hashed or something) and this solved my particular remote connection problem:

update user set Password='5493845039485' where user='joe';

One more thing, in my.cnf you may want to set "port=3306" or whatever port you plan to use.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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