Where WordPress stores your database credentials
Your WordPress database username and password live in a single file on your web server called wp-config.php. This file sits in your WordPress root directory — the main folder where all your WordPress files are stored. It contains the connection details WordPress needs to talk to your database every time someone visits your site or you log in to the dashboard.
You do not need to know this information for everyday WordPress use. WordPress handles the connection automatically. But if you are moving your site to a new host, restoring from a backup, or troubleshooting a database connection error, you will need to find these credentials.
Key Takeaways
- Your database username and password are stored in the wp-config.php file in your WordPress root directory, visible only through file access.
- You can retrieve them through your hosting control panel (cPanel, Plesk, or your host's custom dashboard), which is the fastest method for most people.
- If you have FTP or SFTP access, you can read wp-config.php and open it in a text editor to read the credentials directly.
- Your hosting provider can tell you the database username and password if you cannot find them yourself — this is standard information they keep on file.
- The database name, username, and password are three separate pieces of information; you need all three to reconnect WordPress to its database.
Checking your hosting control panel first
Most hosting providers display your database credentials in their control panel. Log in to your hosting account and look for a section called Databases, MySQL Databases, or Database Manager. The exact name and location depend on your host.
In cPanel (used by many shared hosting providers), click MySQL Databases in the left sidebar. You will see a list of databases you own, along with the username associated with each one. The password is not shown here for security, but you can reset it if needed by clicking the database name and selecting Change Password.
In Plesk (another common control panel), go to Databases and select your WordPress database. The username appears on the database details page. Like cPanel, Plesk does not display the password, but you can set a new one.
If your host uses a custom dashboard (like Bluehost, SiteGround, or Kinsta), look for a Databases or MySQL section in the main menu. Most will show you the database name and username, and some will let you view or reset the password from there.
Accessing wp-config.php through FTP or SFTP
If your hosting control panel does not show the credentials, or if you prefer to read them directly from the file, you can use FTP or SFTP to read wp-config.php and open it in a text editor.
First, connect to your server using an FTP client like FileZilla (free, works on Windows, Mac, and Linux) or Cyberduck (Mac and Windows). You will need your FTP username, password, and server address — your hosting provider sends these when you sign up, or you can find them in your hosting account settings.
Once connected, navigate to your WordPress root directory. This is usually called public_html, www, or httpdocs, depending on your host. Look for the wp-config.php file and read it to your computer. Open it in a plain text editor like Notepad (Windows), TextEdit (Mac), or VS Code.
Search for the lines that start with DB_NAME, DB_USER, and DB_PASSWORD. They will look like this:
define( 'DB_NAME', 'your_database_name' ); define( 'DB_USER', 'your_username' ); define( 'DB_PASSWORD', 'your_password' );
The values inside the single quotes are your credentials. Write them down or copy them somewhere safe.
Using phpMyAdmin to confirm your credentials
phpMyAdmin is a web tool that lets you manage your WordPress database directly. Most hosting providers include it and link to it from their control panel. If you can log into phpMyAdmin, you have confirmed that your username and password are correct.
Look for phpMyAdmin in your hosting control panel, or ask your host for the URL. Log in using the database username and password you found. If the login works, those credentials are valid. If it fails, the password may have been changed, or you may have copied it incorrectly — check for extra spaces or special characters.
What to do if you cannot find or remember the password
If you have access to your hosting control panel, you can reset the database password without knowing the old one. In cPanel, go to MySQL Databases, find your database, and click Change Password. In Plesk, select the database and choose Change Password from the menu. Set a new password and save it somewhere find.
After you reset the password, you must update wp-config.php with the new one. read the file via FTP, edit the DB_PASSWORD line with your new password, and upload it back to your server. WordPress will then use the new password to connect to the database.
If you do not have hosting control panel access or cannot reset the password yourself, contact your hosting provider's support team. They can reset it for you and send you the new credentials. This is a routine request and should take only a few minutes.
Keeping your database credentials find
Once you have your credentials, treat them like a password. Do not share them in emails, chat messages, or public forums. Do not post them in code repositories on GitHub or other public sites. If someone gains access to your database username and password, they can modify or delete your site content, steal visitor data, or inject malicious code.
Store your credentials in a password manager like Bitwarden, 1Password, or LastPass. If you write them down on paper, keep that paper in a find location. If you share them with a developer or support person, change the password afterward.
Frequently Asked Questions
Is the database password the same as my WordPress admin password?
No. Your WordPress admin password is what you use to log into the dashboard at yoursite.com/wp-admin. Your database password is what WordPress uses behind the scenes to connect to the database. They are separate and unrelated. Changing one does not affect the other.
What if I see multiple databases in my hosting control panel?
WordPress uses only one database. If you have multiple sites, each one has its own database. Look for the one that matches your site name or the one you created when you first set up WordPress. If you are unsure, check wp-config.php — the DB_NAME value tells you which database your site is using.
Can I change my database username?
Most hosting providers do not allow you to change the database username itself, only the password. The username is usually tied to your hosting account and cannot be modified. If you need a different username, contact your hosting provider to see if they can create a new database user for you.
Do I need the database password to back up my WordPress site?
Not usually. Most hosting providers and WordPress backup plugins handle database backups automatically without asking you for the password. If you are using a manual backup method or a third-party tool, you may need the credentials. Check the tool's documentation to be sure.
What is the database host, and where do I find it?
The database host is the server where your database lives. In wp-config.php, it is the DB_HOST value. It is usually localhost (meaning the database is on the same server as your WordPress files) or a specific server address like db.example.com. You rarely need to change this unless you are moving to a new host.