Remote Database Connections

WordPress lives in its database, your content makes your site special and unique, and that content lives in the database. If you wish to pluck out your WordPress, what you will be taking is your MySQL database.

In order to connect to a MySQL database remotely, you must have your configuration settings ready.

Host name - Your server IP address
Database name - Your cPanel username database name
Database username - Your cPanel username database username.
Database password - The database user password
Note: You can find your database credentials in your WordPress root folder(File manager-> public_html folder-> wp-config.php) and open the file
MySQL Connection Port - 3306
TCP or UDP, either is fine.

How to set up a Remote Connection to my Database?

By default, servers don't allow remote access to their databases except to specific IP addresses. So we need to add our IP address to the whitelist. If your IP changes frequently, please use a hostname or update the connecting IP in Remote MySQL every time it changes. The connecting computer must be enabled as an Access Host before connecting to MySQL from another computer

Perform the following steps to set up a remote connection to your database

  • Log into cPanel
  • Click the Remote MySQL icon under Databases.
  • Fill in the IP address(You can find and add your IP address directly from this address whatismyip.com)
  • Click Add Host, and you should get a confirmation message Access Host Added and you should now be able to connect remotely to your database.

Remove Access for a Remote Server to Access Your Database
Follow the steps below to remove a host from accessing databases on your server

  • Log into cPanel
  • Click the Remote MySQL icon under Databases.
  • Click the X icon next to the IP address.
  • Click Yes.

Please make sure the credentials match the username created in the "MySQL Database" section of your cPanel to avoid connection issues. After the IP address has been whitelisted to allow remote connection, you should be able to access MySQL remotely using a third-party application like Workbench, phpMyAdmin, etc. Some of these applications are free and some are paid