2013-08-07 130 views
1

我想连接到服务器上托管的MySQL。使用的面板是cpanel。但我无法连接到数据库。使用xamp在本地系统上运行php代码。 错误在下面。当数据在服务器上(cPanel)连接到本地主机的mysql

Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\index.php on line 2 

Warning: mysql_query() expects parameter 2 to be resource, string given in C:\xampp\htdocs\index.php on line 5 

Warning: mysql_error() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\index.php on line 5 

即使我已经把%作为通配符条目来允许所有主机但没有运气。任何想法有什么不对。

回答

1

尝试使用带有域名的端口号mysql_connect();。默认的mysql端口号是3306

mysql_connect('yourdomain.com:3306', 'user', 'password'); 
相关问题