WordPress MySQL Remote DB Connection Set-Up
This Procedure is Particularly Useful when you want to Develop on a Local Machine and after Deploying into the Remote Server.
But this is potential only if your Host Allow MySQL Remote Access.
So before you should need to Check if your Hosting Plan dispose of such Possibility.
This is the Step-by-Step Procedure to Make this Setup.
-
Enable MySQL Remote Access
In CPanel Databases>>Remote MySQL
Insert your IP -
Check you are able to connect to Database:
In Unix-like open a Terminal Sessionmysql -u yourMySQLUser -h xxx.xxx.xxx.xxx -p
-
Change settings in wp-config.php:
define('DB_HOST', 'xxx.xxx.xxx.xxx:port');
OR
define('DB_HOST', 'db.domain.com:port');
You do Not Need to Set the Port if your Connection Use the 3306Default port.
-
Save and Test your Setup :)