无法从客户端网站连接到远程mysql服务器


unable to connect to remote mysql server from client website

网站A:托管在一些免费的网络主机上。

网站B:我的服务器

我想从网站B-(客户端)连接到网站A-(我的服务器)的mysql服务器。

我已授予mysql用户%的远程权限。

但连接不起作用。我试过在不同的免费网络主机上运行php脚本(mysql_connect)。

  • 000webhost.com:无法连接到"我的server IP"上的MySQL服务器(4)
  • biz.nf:查询过程中与MySQL服务器的连接丢失

相同的脚本不同的mysql错误。

这个php脚本在我的在线SERVER上以及localhost设置(远程连接到SERVER)上都能顺利运行。

我必须在SERVER上配置其他内容吗?

我知道免费的网络主机不允许远程mysql连接,但在我的情况下,我正在尝试连接我自己的mysql服务器。

"远程mysql访问"是否意味着内外连接?我搜索了很多,与ip绑定或端口有关吗?我不知道实际问题在哪里?

请帮帮我。

告诉mysql它应该监听一个固定的IP地址,而不是127.0.0.1或localhost。

打开文件/etc/mysql/my.cnf(或/etc/my.cnf):

之前

# 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

之后

# INSERT YOUR IP Address here
bind-address        = 192.168.45.1 
#bind-address=127.0.0.1

然后重新启动mysql服务器。HTH

您的远程网站的防火墙是否允许外部连接到MySQL端口3306?

找出这个来确保你没有旋转你的轮胎