If you’re facing any problems with WordPress automatic installation then you can also edit your wp-config.php file manually with the help of this tutorial. Before starting this tutorial, you need following information:
- Database Name: Name of the database used by WordPress.
- Database Username: Username of the database used by WordPress.
- Database Password: Password of the database used by WordPress.
- Database Value: The hostname of your Database Server.
- Secret Keys: Unique keys. Don’t worry about it.
Create wp-config.php File
There’s no wp-config.php file in the WordPress download, you need to create it. There is a wp-config-sample.php file in the root of your WordPress download, just rename it as wp-config.php. The data in this file are in a specific order, and it matters. Don’t even try to rearrange the contents of the file.
Adding Database Info
First, we need to fill the database info into your wp-config.php file. Search & find following part in your wp-config.php file:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** MySQL database username */ define( 'DB_USER', 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' );
Make following changes to the above code:
- Replace ‘database_name_here’, with the name of your database.
- Replace ‘username_here’, with the name of your username.
- Replace ‘password_here’, with the your password.
- Replace ‘localhost’, with the name of your database host.
Adding Security Keys
Now, we need to put some unique security keys to our wp-config.php file. The keys should be long, hard to remember, and you can easily generate them with one click. Click here & copy the entire page.
Now, find following in your wp-config.php file and replace it with your security keys:
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');
Why Security Keys?
That’s a good question! A secret key makes your site harder to hack and access harder to crack by adding random codes to the password.
Database Table Prefix
Now we need to decide a table prefix for our WordPress database. The default is wp_, but don’t forget to change this to protect your WordPress from various threats. Change wp_ in the following part:
/** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each a unique * prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_';
Replace the wp_ in above code with a something random, such as wp_14jk1h23j2_. As you can see, our randomly generated code is impossible to guess.
That’s it! We will have bunch of more tutorials about this magical WordPress file. You can save your wp-config.php with these above changes and your WordPress will work.