2011-12-30 46 views
0

在此先感谢。我已经在192.168.1.104系统上安装了WAMP服务器,如何连接MySql从其他系统例如:192.168.1.5

我在系统4(192.168.1.104)上安装了WAMP服务器。我可以从System 4本地主机连接MySql DB。

//Code: 
if (!mysql_connect('localhost','root', '')){ 
    die('Could not connect: ' . mysql_error()); 
} 

连接工作正常。

现在我试图从另一台机器连接系统4数据库。

//Code: 
if (!mysql_connect('192.168.1.104','root', '')){ 
    die('Could not connect: ' . mysql_error()); 
} 

我收到在浏览器中此错误

警告:mysql_connect()函数[function.mysql-连接]:主机 '笔记本' 被 不允许d连接到这个MySQL服务器中 :\ XAMPP \ htdocs中\ bigben_new \ testDB.php第7行无法连接: 主机 '笔记本电脑' 是不允许连接到这个MySQL服务器

请给一个解决方案。并感谢提前。

+0

使用['GRANT'(http://dev.mysql.com/doc/refman/5.1/en/grant.html)像'GRANT ALL ON TO *。*'remoteuser'@'yourotherhost'IDENTIFIED BY'password'' - 之后不要忘记'FLUSH PRIVILEGES'。你可以使用'root',但我不会那样做。 – vstm 2011-12-30 09:35:41

+0

非常感谢...现在它的工作 – rkaartikeyan 2011-12-30 11:09:10

回答

3

你必须允许从'192.168.1.5'或全部127.0.0.1

您可以参考以下后访问您的phpMyAdmin'192.168.1.104'

how to give access of PhpMyAdmin

+0

非常感谢它现在的工作 – rkaartikeyan 2011-12-30 11:09:35

相关问题