Setting an external database for WordPress from wp_config file


Staff member

How to use an external database, that is not located in localhost, by setting the WordPress configuration in the file <em>wp_config</em>.

So, all WordPress files (wp_content, wp_admin, ...) are in <em>Local computer A</em>, and the database is in <em>Server B</em>.

Can this be done ?, how would the settings be ?

<strong>What I have tried:</strong>

define('DB_HOST', 'example');
define('DB_HOST', '');
define('DB_HOST', '');
define('DB_HOST', '');


<li>The server is using MySQL on Linux.</li>
<li>When I change the configuration, to use a local database, it works perfect. So it is not WordPress, is the connection setting.</li>
<li>username, password, and database name (DB_NAME, DB_USER, DB_PASSWORD) are correct. </li>

<strong>Current error:</strong>

Error establishing a database connection

<strong>Related links:</strong>

<a href="" rel="nofollow"></a>

<a href="" rel="nofollow"></a>

<a href="" rel="nofollow"></a>