gpt4 book ai didi

Mysql远程访问lighttpd

转载 作者:太空宇宙 更新时间:2023-11-04 04:22:58 25 4
gpt4 key购买 nike

我的服务器运行 LightHTTPD。我正在尝试访问此服务器上的 MySQL/PHPMyAdmin。到目前为止,我已经用谷歌搜索了太多并尝试了很多东西。我最近这样做了,编辑了这个文件/etc/mysql/my.conf,添加bind-address =我的服务器的ip;,然后我这样做了:

mysql -u root -p
mysql> GRANT ALL ON databasename.* TO root@'0.0.0.0' IDENTIFIED BY 'pasword';

现在,当我尝试从我授予的 IP 连接到该服务器时,它给了我这个错误:

ini_set('display_errors',1); 
error_reporting(E_ALL);
define("DB_NAME","pun_update");
define("DB_USER","root");
define("DB_PASS","");
define ("DB_SERVER","ip of my server");

function connect()
{
$db_handle = mysql_connect(DB_SERVER,DB_USER,DB_PASS)
or die("Unable to Connect to Database check your settings");

mysql_select_db(DB_NAME,$db_handle) or die ("Database doesnot exist");

}

connect();

我收到此错误:

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110

最佳答案

不要使用 IP,而是尝试使用远程服务器的实际 url。检查this上一个问题。

更新:

根据this页面,错误110是连接超时。

MySQL 站点 ( MySQL server has gone away ) 引用了可能导致此问题的实例(您应该检查它们)。这是一个值得注意的(针对您的情况):

Another networking issue that can cause this error occurs if the MySQL port (default 3306) is blocked by your firewall, thus preventing any connections at all to the MySQL server.

还有另一个问题 ( Lost connection... ),如果这是原因,它可能与您的问题相关。

否则请检查您是否确实使用了正确的参数进行连接。如果可能的话,尝试在服务器本身上。

希望这有帮助!

关于Mysql远程访问lighttpd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11592063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com