Ubuntu Remote connection MySQL (connection refused) workaround

Source: Internet
Author: User
Tags flush

First, to determine whether Ubuntu open the firewall

sudo ufw status

Open firewall 3306 Port

sudo ufw allow 3306

Second, see if Port 3306 is open


Note: The red box indicates that the IP address of the 3306 binding is –> unmodified before:127.0.0.1:3306–> that is MySQL default bind localhost, remote access is not
* If it is bound to 127.0.0.1 then continue to see the third step, otherwise please skip the third step

Third, modify the MySQL configuration file, will bind-address = 127.0.0.1 comments, open all connections

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 

Restart Ubuntu and check the 3306 port status again with the second step

Iv. trying to connect to MySQL via Telnet

telnet your-remote-ip-address 3306

If you can't connect, proceed to the next step

To authorize the root user to all connections
Step1: Go to MySQL
Step2:
Law One > Change Table method: Go to MySQL database, check inside user table, search user= ' root ' record

Note: Here is the revised record
To modify host= ' localhost ' records:

SET Host = ‘%’ WHERE User = ‘root’ AND Host=’localhost’;

Make the changes effective:

mysql> FLUSH PRIVILEGES;

Law Two > Authorization law:
Example: Allow root user to connect to MySQL from any host using password password:

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION;

Make the changes effective:

mysql> FLUSH PRIVILEGES;

Finally, the fourth step can be tested to verify the ability to remotely connect to the mysql~

Ubuntu Remote connection MySQL (connection refused) workaround

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.