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.

How-to guideBeginner2 min readUpdated

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 then 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 free for 30 days, then £0.99 a month.

Popular

Tip: press / to search from any pageSee all results