DataGrip Failed to Connect to Centos MySql
First check if Mysql is running:
systemctl status mysqld, if it shows not started, you need to start mysql.Check if the firewall is open, and if port 3306 is open.
sudo firewall-cmd --list-all
If 3306 is not open below, then open port 3306.
1 | public |
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent If added successfully, it shows success.
Local test to see if connection is successful
telnet ip 3306. It shows connection implemented but ping ip is successful.Later I realized this is a cloud server, it might be related to the inbound rules set on the web page.
Opened Tencent Cloud’s inbound/outbound rule settings and found port 3306 was not open. Opened the port.

Re-used
telnetand connected successfully.Logged in using DataGrip, test connection successful.



