05. How to Remote Connect to a MySQL Database Print

  • 0

How to Remote Connect to a MySQL Database

Step 1: Authorize Your IP Address

Before your software can connect to the server, your computer must be recognized as a trusted source.

  1. Find your public IP: Search "What is my IP" on Google and copy the numeric address (e.g., 1.2.3.4).
  2. Log in to cPanel: Navigate to the Databases section and click Remote MySQL®.
  3. Add Access Host: Paste your IP address into the Host field.
  4. Optional: Add a comment like "Home Office" to remember this IP.
  5. Click Add Host: You should see a success message confirming the IP is authorized.

Step 2: External Connection Settings

Use your database client (e.g., MySQL Workbench, DBeaver) with the following details:

  • Hostname/Server: Your domain name (e.g., yourdomain.com) or server IP.
  • Port: 3306 (standard MySQL port).
  • Username: Full database username (e.g., user_dbadmin).
  • Password: The password set when creating the database user.
  • Database: Optional — specify a database (e.g., user_store).

Step 3: Troubleshooting Common Issues

  1. Connection Timed Out: Usually caused by a firewall or ISP blocking Port 3306. Ensure outgoing traffic is allowed.
  2. "Access Denied" Error:
    • Check Username: Must include full prefix (e.g., user_dbadmin).
    • Check IP: If your ISP uses dynamic IPs, update your authorized IP in Remote MySQL if it changes.
  3. Using a Wildcard (%):
    • Allows any IP to attempt login. ⚠ Security Risk: This increases the risk of brute force attacks. Use your specific IP whenever possible.
???? Pro Tip: Use SSH Tunneling for maximum security. Many database clients (DBeaver, Sequel Ace) support it. This tunnels traffic securely and removes the need to open Port 3306 or authorize your IP.

Was this answer helpful?

« Back