How to change a database user’s password
Reset a MySQL user’s password in DirectAdmin and update your application’s configuration so the site doesn’t go down.
Changing a database password immediately breaks any application still using the old one. Have the configuration file ready to update.
Steps
- Open Account Manager › MySQL Management.
- Select the database, then the user.
- Choose to change the password, enter a new one, and save.
- Straight away, update the password in the application’s configuration file:
| Application | File | Setting |
|---|---|---|
| WordPress | wp-config.php | DB_PASSWORD |
| Laravel | .env | DB_PASSWORD |
| Joomla | configuration.php | $password |
| Custom PHP | Your config file | Varies |
- Reload the site.
Special characters
Some characters need escaping in configuration files: a ' inside a PHP single-quoted string, or # and spaces in .env files (wrap the value in double quotes). Using letters, numbers and - or _ in a long password avoids the problem entirely.
When to change it
- After a developer or agency no longer needs access
- After a suspected compromise
- If the password has ever been shared in email or chat
Every Traxio account includes a MySQL database with phpMyAdmin. If you’re still choosing a host, PHP and MySQL hosting is £0.99 a month.
If it doesn’t work
These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.
- Database connection failedFix ‘Access denied for user’, ‘Unknown database’ and connection errors in PHP apps by checking prefixes, passwords, privileges and host.
- phpMyAdmin won’t open, logs out or times outFix common phpMyAdmin problems: login loops, session expiry, blank pages, import timeouts and ‘max_input_vars’ warnings.
- “Error establishing a database connection” in WordPressFix WordPress’s database connection error: check wp-config.php credentials, database user permissions, the database host and damaged tables.
Common questions
How do I change a database password?
Change it for the database user in Account Manager › MySQL Management, then immediately update the same password in your application’s configuration file — wp-config.php for WordPress. The site goes down the moment the two stop matching.
Spotted something out of date or unclear? Tell us and we’ll fix it.