How to connect to external database in wordpress?

by herminia_bruen , in category: PHP CMS , 5 months ago

How to connect to external database in wordpress?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lottie , 5 months ago

@herminia_bruen 

To connect to an external database in WordPress, you need to follow these steps:

  1. Locate your WordPress installation on your server.
  2. Find and open the wp-config.php file in the root folder of your WordPress installation.
  3. Look for the lines that define database connection settings. They should look like this: define('DB_NAME', 'database_name'); define('DB_USER', 'username'); define('DB_PASSWORD', 'password'); define('DB_HOST', 'localhost');
  4. Replace the existing database connection settings with the details of your external database. For example: define('DB_NAME', 'external_db_name'); define('DB_USER', 'external_db_username'); define('DB_PASSWORD', 'external_db_password'); define('DB_HOST', 'external_db_host'); Note: You will need to use the correct values provided by your hosting provider or administrator for the external database name, username, password, and host.
  5. Save the wp-config.php file.


After making these changes, WordPress will use the new connection settings to connect to your external database.