up vote 3 down vote favorite
share [g+] share [fb]

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

link|improve this question

74% accept rate
feedback

2 Answers

up vote 6 down vote accepted

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. Don't forget to restart your mysqld after that change.

Best wishes,
Fabian

link|improve this answer
got a different error now: Could not connect to host '192.168.0.2'. 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
feedback

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

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON databasename.*
TO 'username'@'clientipaddress'
IDENTIFIED BY 'password'

As I learned on

http://forums.mysql.com/read.php?86,23619,41248#msg-41248

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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