To test a remote MySQL connection in Linux terminal:
mysql -u username -h 184.108.40.206.22 -p
Or via Telnet in WIndows:
telnet 220.127.116.11.22 3306
If you are getting an error when trying to connect to your remote MySQL server
ERROR 2003 (HY000): Can't connect to MySQL server on '18.104.22.168.22' (111)
or in Telnet
Connecting To 22.214.171.124.22...Could not open connection to the host, on port 3306: Connect failed
1. Check Firewall
ufw firewall is enabled, ensure you have a rule for MySQL
sudo ufw allow mysql
Restart the service
sudo service ufw restart
2. Check MySQL config
You may need to comment out
bind-address in the MySQL config file
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Find the line
W to search)
... # # 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 ...
The above line is telling MySQL to only accept local connections. Comment out this line by adding
# before it.
Restart the MySQL service for changes to take effect.
sudo service mysql restart
p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.