在PHP中使用IP地址连接MySQL数据库
作者:Aliot
发布时间:2017-07-02
评论:0
阅读:0
在PHP中使用IP地址连接MySQL数据库
时间:2014-04-06 csdn rootsongjc
我们通常测试的时候都是用mysql_connect ("localhost","usrname","password");的方式来连接MySQL数据库的 ,
如果我们要通过其他主机使用IP地址来连接MySQL数据库的时候,就需要修改MySQL的配置文 件/etc/mysql/my.cnf,否则会出现这样的错误提示:
can t connect to mysql server on 111
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1 //这一行是要注释掉的
只要注释掉这一行bind-address之后再重启mysql就可以通过其他机器使用IP地址来连接mysql了。
查看本栏目更多精彩内容:http://www.bianceng.cn/webkf/PHP/