Once I wrote a tutorial on what to do when you delete the
wp-config.php file, the article was in Bengali (
ওয়ার্ডপ্রেসের wp-config.php মুছে ফেললে করণীয় (Web Archive)
You can use Google Translate to get the gist of the article.
- Copy the
wp-config-sample.php, paste and rename the file into
- Find out the database table that is responsible for the project, and get the MySQL settings as well. Now fill the database credentials:
define( 'DB_NAME', 'database_name_here' ); // DATABASE
define( 'DB_USER', 'username_here' ); // MySQL username
define( 'DB_PASSWORD', 'password_here' ); // MySQL password (empty string for no password)
define( 'DB_HOST', 'localhost' );
- For the Unique Keys and Salts, get to WordPress Secret Key (Salt) Generator – WordPress API and copy all the texts, replace the following code with copied texts:
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' );
- For the table prefix, get to the database using a DB application like PHPMyAdmin and see the table prefixes there. Typically they start with
wp_, if you notice any changes there, you can change the following line with the one that you have in your table names:
$table_prefix = 'wp_';
And that's all. It is that simple.
If you see 404 in some pages you can get to the
/wp-admin » Settings » Permalinks, and hit the Save Changes button to refresh the
.htaccess Rewrite rules.
As you said:
I tried to revert the local WP-config file back to link it to my site's local database, but I am now prompted to go through a new installation of Wordpress (language settings, etc.).
This probably because you put the wrong database name in the
DB_NAME definition (
define( 'DB_NAME', 'database_name_here' );), what needs to the exact same database that was responsible for the local website. If the database name was correct, then, your database might be truncated, etc. If so, you will need to recover the database from your backup (or as you have a remote version, you can grab the data from there too).