Problem:
How to use an external database, that is not located in localhost, by setting the WordPress configuration in the file wp_config.
So, all WordPress files (wp_content, wp_admin, …) are in Local computer A, and the database is in Server B.
Can this be done ?, how would the settings be ?
What I have tried:
define('DB_HOST', 'example');
define('DB_HOST', 'example.com');
define('DB_HOST', 'http://example.com');
define('DB_HOST', 'example.com:22');
Notes:
- The server is using MySQL on Linux.
- When I change the configuration, to use a local database, it works perfect. So it is not WordPress, is the connection setting.
- username, password, and database name (DB_NAME, DB_USER, DB_PASSWORD) are correct.
Current error:
Error establishing a database connection
Related links:
http://codex.wordpress.org/Editing_wp-config.php
http://wordpress.org/support/topic/connect-local-wordpress-site-to-remote-database
To start the diagnosis, I would do the following :
define('DB_HOST', 'example.com:port');
is the correct format. Can you try to use the IP address? Also mySql listen on port 3306 by default.