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.

Guide2 min readLast updated
On this page
  1. Steps
  2. Special characters
  3. When to change it
  4. If it doesn’t work
  5. Common questions

Changing a database password immediately breaks any application still using the old one. Have the configuration file ready to update.

Steps

  1. Open Account Manager › MySQL Management.
  2. Select the database, then the user.
  3. Choose to change the password, enter a new one, and save.
  4. Straight away, update the password in the application’s configuration file:
ApplicationFileSetting
WordPresswp-config.phpDB_PASSWORD
Laravel.envDB_PASSWORD
Joomlaconfiguration.php$password
Custom PHPYour config fileVaries
  1. 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.

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.

Keep going