Technology Encyclopedia Home >What to do if MariaDB's Navicat MySQL 8.0.x version reports a connection error?

What to do if MariaDB's Navicat MySQL 8.0.x version reports a connection error?

If Navicat for MySQL 8.0.x reports a connection error with MariaDB, follow these steps to diagnose and resolve the issue:

  1. Check Network Connectivity
    Ensure the MariaDB server is reachable from your client machine. Use ping or telnet to verify the connection:

    ping <MariaDB_server_IP>  
    telnet <MariaDB_server_IP> 3306  
    

    If the port is blocked, check firewall settings or security groups (e.g., Tencent Cloud Security Group rules).

  2. Verify MariaDB Server Status
    Confirm MariaDB is running on the server:

    systemctl status mariadb  
    

    If stopped, restart it:

    systemctl start mariadb  
    
  3. Check User Privileges
    Ensure the MySQL user has the correct permissions to connect from the client IP. Log in to MariaDB locally and run:

    SELECT host, user FROM mysql.user;  
    GRANT ALL PRIVILEGES ON *.* TO 'username'@'client_IP' IDENTIFIED BY 'password';  
    FLUSH PRIVILEGES;  
    

    Replace username, client_IP, and password with your credentials.

  4. Validate Connection Settings in Navicat
    Double-check the connection details in Navicat:

    • Hostname/IP address (e.g., 127.0.0.1 or remote server IP).
    • Port (default is 3306).
    • Username and password.
    • Ensure "Use SSL" is unchecked unless required.
  5. Check MariaDB Configuration
    Verify bind-address in /etc/mysql/my.cnf or /etc/mysql/mariadb.conf.d/50-server.cnf:

    bind-address = 0.0.0.0  # Allows remote connections  
    

    Restart MariaDB after changes:

    systemctl restart mariadb  
    
  6. Enable Logging for Debugging
    Check MariaDB error logs for details:

    tail -f /var/log/mysql/error.log  
    
  7. Tencent Cloud-Specific Recommendations
    If using Tencent Cloud, ensure:

    • The MariaDB instance is in the same VPC as your client or has proper peering.
    • Security Group rules allow inbound traffic on port 3306 from your client IP.
    • Use Tencent Cloud’s Database Connection Pooling or Private Network Access for enhanced security and performance.

Example: If connecting from a remote machine, ensure the Tencent Cloud Security Group allows 3306 from your IP, and the MariaDB user has % (any host) or your specific IP in privileges.