简体   繁体   中英

Ubuntu + MySQL remote connections

I run two servers one being a web hosting and one being a VPS. I want to use my MySQL server on my web hosting and done everything possible but it still will not work. 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. I then got told to comment out bind_address in the config but once again it failed.

How can I go about fixing this? Thanks.

You have to allow mysql to accept requests from remote not only localhost.

To do that you should edit /etc/mysql/mysql.conf.d/mysqld.cnf and change from:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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