Create a complete wp-config.php in a minute: database details, random security keys, debugging, memory and update settings, and basic hardening. The file is made in your browser, so your database password goes nowhere.
When WordPress moves to a new host with a different database and user.
After a hack
A clean file with new keys ends every old session.
Manual install
When you upload WordPress yourself instead of a one-click install.
Before you upload it
Do
Keep a copy of the current file before replacing it
Set the file permissions to 600 or 640
Use a database user for this site only
Avoid
Changing the table prefix on a live site without renaming tables
Leaving development mode on a live site
Uploading it anywhere it can be read in a browser, like a .txt copy
If you get a database connection error after uploading, see the error guide. To turn on the error log step by step, see debugging WordPress.
Example: moving a site to a new host
After copying the files and importing the database, create a database and user in cPanel, enter them here with the same old table prefix, and put the URL in the site URL box. Upload the file over the old one and open the site. If the domain changed, replace URLs with search-replace from the WP-CLI tool.
Key terms
Short definitions of what you meet along the way.
DB_HOST
The database server address, usually localhost.
ABSPATH
The full path of the WordPress folder on the server.
We use necessary cookies to run the site, and Google Analytics to measure visits only if you agree. You can change your choice at any time from “Cookie settings”. Privacy policy