Linux, Web Server & Database
Reset MySQL User Password
Reset a forgotten or compromised MySQL/MariaDB user password, including root if needed.
The Problem
You've lost or forgotten a database password — sometimes even the root password — and need access restored without losing any data in the process.
About this problem
Resetting a regular MySQL user's password is usually trivial if you already have another account with sufficient privileges, but losing the root password specifically requires a more careful recovery process involving restarting MySQL in a special safe mode, since by design there's no simple 'forgot password' link for a database server.
This comes up after a staff change, a forgotten credential that was never documented, or suspicion that a password may have been exposed somewhere and needs rotating.
What's Included
- Resetting the password for the affected user account
- For root password recovery specifically, safely restarting MySQL in the recovery mode needed to reset it
- Updating any application configuration that references the old password
- Confirming the new password works correctly before considering it done
What's NOT Included
- Recovering data if the password loss was accompanied by actual data loss (a separate issue)
- Setting up a password manager or credential storage system for you going forward
- Auditing every place the old password might have been used beyond the applications you specify
How It Works
- For a regular user, connect with an account that has sufficient privileges and run ALTER USER or SET PASSWORD for the affected account.
- For a lost root password, stop MySQL, restart it with --skip-grant-tables in a controlled, brief window, and reset the root password through that safe-mode access.
- Restart MySQL normally afterwards and confirm the new root (or user) password works correctly.
- Update any application config files, environment variables or connection strings that reference the old password.
- Test each affected application's connection with the new credentials to confirm everything reconnects properly.
In practice: you buy the service, send over whatever access or details the job needs, I investigate and do the work, and you confirm it's resolved before we call it done.
Frequently Asked Questions
- What do I do if I forgot my MySQL root password?
- It requires restarting MySQL in a special safe mode (skip-grant-tables) briefly to reset it directly, since there's no simple recovery email or reset link for a database server.
- Will resetting a MySQL password cause downtime?
- Resetting a regular user's password doesn't require any downtime; resetting the root password via safe mode does require briefly restarting the MySQL service.
- Do I need to update my application after resetting a database password?
- Yes — anywhere that password is stored (config files, environment variables, connection strings) needs updating to match, or the application will fail to connect with the old credentials.
- How often should I rotate database passwords?
- There's no universal rule, but rotating after any staff change, suspected exposure, or as part of periodic security hygiene is generally good practice.
- Can I reset a MySQL password without SSH access to the server?
- Not for a root password recovery specifically, since that process requires direct access to restart the MySQL service — a regular user's password can sometimes be reset via a hosting control panel instead.
- Is it risky to use safe mode to reset the root password?
- It's a well-established, standard recovery procedure when done correctly and briefly, though it does mean the database is temporarily running without its normal access controls during that window.