MySQL – How to Setup a MySQL Server to Accept Remote Connections

MySQLnetworkingUbuntu

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 '192.168.0.2'.

MySQL Error Nr. 2003

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

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

The ping is ok, though

Best Answer

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

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

bind = 127.0.0.1

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