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 its 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, re-uploading to the server. But you can also edit this file within cPanel.
- Log into your cPanel.
- Once logged in, navigate to find the File Manager.
- From the File Manager, click through the folders to find where your WordPress is installed.
- Inside that folder, you should see a wp-config.php file. Right-click on that file and choose Edit.
- 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. Where you would need to change these, situations would include any hosting migrations or even regular password changes. Here's what each of those options means and what you can change them too.
- The DB_NAME variable is used to define the current database name for WordPress. Suppose 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 you can also create this user in the database if needed. If changed, you can set that here by changing that second text.
- DB_PASSWORD is the password for the user to login into the database. This would be the most common option 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 connect 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 will 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 need this to be changed specifically.
Many other things can be changed in the wp-config.php file that affects your WordPress installation. WordPress also has a handy guide on what the possible changes can be. However, we can assist as well if needed.
If you should have any questions or would like assistance, please contact us through Live Chat or by submitting a ticket with our Technical Support team.