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