ALTER USER or SET PASSWORD lets you securely update a MariaDB account’s credentials without recreating the user.
Change passwords after staff turnover, on schedule (e.g., every 90 days), or immediately after a suspected breach to block unauthorized access.
Use ALTER USER for modern MariaDB versions (10.4+) and SET PASSWORD for legacy compatibility. Both modify the mysql.user table instantly.
ALTER USER updates the account row and re-authenticates future sessions. Include IDENTIFIED BY for plain text or IDENTIFIED VIA for plugins.
SET PASSWORD only changes the password hash. It cannot switch authentication plugins, so prefer ALTER USER when possible.
GRANT OPTION or global ALTER USER privilege is needed. The root or DBA role normally performs the change.
Login as root on the server host, then run ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewR00tPass!';. Always choose a long, unique passphrase.
Create a scheduled job that expires passwords by setting PASSWORD EXPIRE and notify users through your CI/CD pipeline or a chat-ops bot.
Use TLS when connecting, generate random 14+ character passwords, store them in a secrets manager, and audit the mysql.user table for forgotten accounts.
Yes, if the account has remote access and you connect over TLS. Otherwise, use an SSH tunnel or VPN.
No. Existing sessions remain connected. Users must reconnect to authenticate with the new password.
Yes. Use mysql client with --execute inside CI jobs or configuration-management tools like Ansible, Chef, or Terraform.
Run SELECT User, Host, authentication_string FROM mysql.user WHERE User='report_user'; and confirm the hash has updated.