MySQL:my.cnf中的绑定地址0.0.0.0不起作用?


11

我是mysql新手。我想使用我想要的任何IP连接到mysql服务器。我读到我要做的就是将mybind.address = 0.0.0.0添加到my.cnf文件中。那就是我所做的。我重新启动了mysql服务器,然后从命令行对其进行了测试。

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)

您可以在my.cnf文件中的mysqld部分的下面看到

[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

预先谢谢你,尼科斯


对不起,我误读了整个问题,就我所知无法使用多个IP而言,也许这可以为您提供帮助,但实际上无论如何都不需要。请问您为什么要这样做?cyberciti.biz/faq/…–杰里德普
Jeredepp)2014年

Answers:


7

配置选项bind-address告诉MySQL要监听哪些接口。通过收到错误,Access denied for user 'root'@'mguru.lnx.gr'我们可以看到它实际上工作正常。

您需要做的是修改MySQL的特权系统,以便能够从进行连接'mguru.lnx.gr'。MySQL中特权的潜在混乱部分是用户名+主机的组合。

此处的MySQL手册对此进行了介绍。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.