The wp-config.php is a fundamental part of your WordPress installation. It specifies, most importantly, information about how to connect to your WordPress database, which is where most of your content is stored. Without this file, your WordPress installation is an empty shell.
Let's take a look at a the most important parts. You can use an FTP client or the cPanel File Manager to view your wp-config.php file. If you do you'll see the following section pretty close to the top:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'username_wp1');
/** MySQL database username */
define('DB_USER', 'username_admin');
/** MySQL database password */
define('DB_PASSWORD', 'a1S@d3f$');
/** MySQL hostname */
define('DB_HOST', 'localhost');
The above section is where WordPress specifies the MySQL database, the MySQL username and the MySQL user password (which is different than your cPanel username and your wp-admin username). When someone clicks to one of your WordPress articles WordPress pulls the images from your media folder, which is usually in your wp-content folder. But it pulls all the text and metadata for your article from the database, using the info specified here in the wp-config.php file.
Note: if your WordPress gives you a database connection error, that often means that the data mentioned above is not correct.
On a cPanel system, you can create the database, user, and password without having to ever log in to the command line.
If you use Softaculous, then you specify the name of the MySQL database when you install, but it actually creates the database for you and assigns a user and password to it automatically! Done and done.
Tip! You can also use the wp-config.php file to correct a half-changed site URL! If you want to use a new domain name for your site, and make the change in WHM/cPanel before you make the change in the wp-admin area, your site may not work anymore. And you won't even be able to log in to the admin area to fix it, because that area relies on the domain name too. --- If you have access to the wp-config.php file, however, you can simply add these following lines at the bottom, using your new domain name, and the site will work again.
define('WP_HOME','http://www.yournewdomainname.com');
define('WP_SITEURL','http://www.yournewdomainname.com');
Note: Be sure to add above the lines /* That's all, stop editing! Happy blogging. */