What Is The wp-config.php File?
Quick Navigation Links
If you have installed WordPress, you may see that there is a file called wp-config.php. The name of the file actually gives away it’s purpose. This file is meant to be a configuration file for your WordPress installation. In it, you will find the database connection details and various other configuration options. While it may be a scary looking file and changes made here could break your site, we will go into what some of these options are and why you would want to change them.
How Do I Edit The wp-config.php File?
Usually you may want to edit this file by downloading it to your local computer. Then once the changes are made, reuploading to the server. But you can also edit this file within cPanel.
Step 1: Log into your cPanel.
Step 2: Once logged in, navigate to find the File Manager.
Step 3: From the File Manager, click through the folders to find where your WordPress is installed.
Step 4: Inside that folder you should see a wp-config.php file. Right click on that file and choose Edit.
Step 5: This will open up a text editor within cPanel where you can make direct edits to the file.
Changing Database Login Credentials
One of the most common reasons you would want to edit the wp-config.php file would be to change the database login information. Situations where you would need to change these would include any hosting migrations, or even regular password changes made. Here’s what each of those options mean and what you can change them to.
- The DB_NAME variable is used to define the current database name for WordPress. If the database name for your WordPress installation changes at some point. You would want to modify this option to let WordPress know. Modify the second text, the one after ‘DB_NAME’.
- DB_USER is used to specify the user when connecting to the database. Usually this would change per database, but if needed you can also just create this user in the database as well. If changed, you can set that here by changing that second text.
- DB_PASSWORD is the password for the user to login to the database. This would be the most common of the options to change, as the password may change the most frequently. Make sure that this password is accurate to the one that works for the above mentioned DB_USER.
- The DB_HOST is used to specify the server where WordPress will try to connect to when looking for the database. By default, localhost means that the Database is on the same server as the website. If you have your database on another server, you will input that server address or host-name here.
- DB_CHARSET determines the character set that will be used for creating database tables for WordPress. You would mainly want to change this if you need a particular character set for a different language. For example, if you were using the Greek Alphabet in your database, you would want the DB_CHARSET to be set to iso-8859-7 . Though usually the default value for this can remain.
- As it states, the DB_COLLATE affects how WordPress databases Collate. Basically the Collation of a table affects how it is sorted based on lettering. This can remain the default, unless you are needing this to specifically be changed.
There are a bunch of other things that can be changed in the wp-config.php file that affect your WordPress installation. WordPress also has a handy guide on what the possible changes can be. Though we can assist as well if needed.
- WordPress Codex > Editing wp-config.php – WordPress site that shows possible edits that can be made to the wp-config.php file.
- Installing WordPress Using Softaculous
- Enable HTTPS In WordPress
- How To Add HTML To Your WordPress Page
- Definition Of cPanel File Manager