简体   繁体   English

Ubuntu + MySQL远程连接

[英]Ubuntu + MySQL remote connections

I run two servers one being a web hosting and one being a VPS. 我运行两台服务器,一台是虚拟主机,一台是VPS。 I want to use my MySQL server on my web hosting and done everything possible but it still will not work. 我想在我的虚拟主机上使用我的MySQL服务器,并尽一切可能,但仍然无法正常工作。 I started by running the mysql command to grant privileges and it showed that the command went through fine although I still got a refused connection on my web server. 我首先运行mysql命令来授予特权,尽管我的Web服务器上仍然有拒绝连接,但它表明命令运行正常。 I then got told to comment out bind_address in the config but once again it failed. 然后,我被告知在配置中注释掉bind_address,但再次失败。

How can I go about fixing this? 我该如何解决这个问题? Thanks. 谢谢。

You have to allow mysql to accept requests from remote not only localhost. 您必须允许mysql接受不仅来自本地主机的远程请求。

To do that you should edit /etc/mysql/mysql.conf.d/mysqld.cnf and change from: 为此,您应该编辑/etc/mysql/mysql.conf.d/mysqld.cnf并从以下位置进行更改:

bind-address = 127.0.0.1

to: 至:

bind-address = 0.0.0.0

and restart the mysql server with this command: systemctl restart mysql.service 并使用以下命令重新启动mysql服务器: systemctl restart mysql.service

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM