Do you need to point your new instance of MySQL Database to your WordPress site? Or how do you change authentication details with your database? Maybe changing username or password to access MySQL database?
Your WordPress site and MySQL database co-exist and are linked together as this two-tier relationship also known as front-end and back-end. You can store your content, posts, media & pages in one structured place and that’s MySQL’s job. And on the flip side, you have the WordPress front-end making it all look pretty and structured.
Ok, let’s have a look into how to keep this relationship happy and configured so that these two worlds can co-exist and serve your content to your audience.
If you host your site on Windows IIS the chances are you will find wp-config.php file in the root folder of your site’s file system (picture below).
- Navigate to your site’s file system using your preferred FTP client, such as FileZilla.
- Find wp-config.php file and open it in text editor, such as Visual Studio Code or Notepad++.
- Locate define constants towards the top of the file.
- Edit the define constants with your secure values as per examples below.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'DATABASE NAME' );
/** MySQL database username */
define( 'DB_USER', 'DATABASE USER NAME' );
/** MySQL database password */
define( 'DB_PASSWORD', 'DATABASE USER PASSWORD' );
/** MySQL hostname */
define( 'DB_HOST', 'DATABASE HOST' );
- Save wp-config.php file and test MySQL connection.
Word of caution, make sure you set the correct values, otherwise you will loose connectivity between your WordPress web-front and the back-end MySQL Database.
On a side note, if you are still in the mood of code or configuration changes, why not look at my other post explaining How to redirect HTTP to HTTPS on WordPress.