Editing WordPress core files is a very risky and hard job, especially for WordPress beginners like me. Yea, I'm using WordPress only from last four months, but I have learned a lot from it.
The wp-config.php file is one of the most important files in WordPress. It contains the login information for WordPress to connect to your database as well as table prefix, secret keys, e.t.c. Editing wp-config.php file is very easy, but this file looks a bit scary so beginners usually keeps themselves away from it.
If you installed WordPress using your hosting provider's install wizard, then wp-config.php file will be in your root directory. If you installed WordPress using FTP, then you can find wp-config.php (named as wp-config-sample.php) file in your WordPress download. Don't forget to rename wp-config-sample.php to wp-config.php.
Adding Database Info:
To change the wp-config.php file for your installation, you will need this information:
Database Name
Database Name used by WordPress
Database Username
Username used to access Database
Database Password
Password used by Username to access Database
Database Host
The hostname of your Database Server. A port number, Unix socket file path or pipe may be needed as well.
Find following lines in your wp-config.php file:
define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
define( 'DB_PASSWORD', 'password_here' );
define( 'DB_HOST', 'localhost' );
It's not that hard. We just have to replace above text with our database's info.
Set Database Name:
Replace 'database_name_here', with the name of your database, e.g. MyDatabaseName.
define( 'DB_NAME', 'MyDatabaseName' );
Set Database User:
Replace 'username_here', with the name of your username e.g. MyUserName.
define( 'DB_USER', 'MyUserName' );
Set Database Password:
Replace 'password_here', with the your password, e.g. MyPassWord.
define( 'DB_PASSWORD', 'MyPassWord' );
Set Database Host:
Replace 'localhost', with the name of your database host, e.g. MyDatabaseHost.
define( 'DB_HOST', 'MyDatabaseHost' );
That's it for this part. Now we have to follow one simple step to complete our wp-config.php file.
Adding Secret Keys:
Now we just have to add some unique keys to our wp-config.php file. Find following in your wp-config.php file:
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
Put your unique keys in above spaces. You don't have to remember the keys, just make them long, random and complicated. You can change these keys at any time. You can also use WordPress' online generator to automatically generate these keys for you.
These secret key protects your site from getting hacked. A password like "password" or "facebook" is simple and easily broken. A random password such as "w<$4c$aPHmd%/*]`Oom>(hpdXW|0M=X={we6;Mphvtg+V.o<$|#_}qG(GaVDEsn,~*4i')" takes years to come up with the right combination.
That's it for this time. Now after adding/editing above details, your wp-config.php file is ready for some action. You can now save/update the file to your file manager's root directory to see it in action.