• 冒险村物语
  • 英雄无敌3塔防
  • 驾考家园手游

PHP使用IP地址连接MySQL数据库

2014-09-05

我们通常测试的时候都是用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了。
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)

人气推荐

知识阅读

精彩推荐

  • 游戏
  • 软件
查看更多>>