11

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

  • Sorry i misread the whole question, maybe this can help you, as far as i know it is not possible to use multiple IP's, really it shouldn't be neccessary anyway. May i ask why you want to do such a thing? cyberciti.biz/faq/… – Jeredepp May 7 '14 at 6:29
7

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.

protected by Paul White Sep 4 '15 at 11:49

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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