MySQL: bind-address 0.0.0.0 in the.cnf does not work

my.cnfMySQL

I'm new to mysql.
I want to connect to mysql server using whatever ip I want.
I read that all I have to do is to add to my.cnf file the line bind-address = 0.0.0.0.
That's what I did.
I restarted mysql server and then I tested it from command line.

mysql -uroot -p'*password*' -h 127.0.0.1 --> Works
mysql -uroot -p'*password*' -h 192.168.2.4 (local ip address) --->
ERROR 1045 (28000): Access denied for user 'root'@'mguru.lnx.gr' (using password: YES)

You can see below part of the section mysqld in my.cnf file

[mysqld]
user = mysql
port=3306
socket          = /opt/lampp/var/mysql/mysql.sock
skip-external-locking
key_buffer = 16M

max_allowed_packet = 1M

table_open_cache = 64

sort_buffer_size = 512K

net_buffer_length = 8K

read_buffer_size = 256K

read_rnd_buffer_size = 512K

myisam_sort_buffer_size = 8M

plugin_dir = /opt/lampp/lib/mysql/plugin/
#skip-networking
bind-address=0.0.0.0

Thank you in advance,
Nikos

Best Answer

The configuration option bind-address tells MySQL what interfaces to listen on. By receiving the error Access denied for user 'root'@'mguru.lnx.gr' we can see that is actually working fine.

What you will need to do is modify MySQL's privilege system so that you are able to connect from 'mguru.lnx.gr'. The potentially confusing part of privileges in MySQL is that it is the combination of a username + the host.

This is covered in the MySQL manual here.