How do I reset a forgotten MySQL root password?
Try sudo mysql first, since root may use socket authentication. Otherwise reset safely with --init-file or --skip-grant-tables and --skip-networking. Includes Docker and managed databases.
In this article
- 01First: maybe root doesn't use a password at all
- 02Reset a forgotten password with --init-file (recommended)
- 03Alternative: --skip-grant-tables
- 04In Docker
· 6 min read
