Resetting the MySQL root password

Last modified on July 24, 2026 • 1 min read • 77 words
If you have forgotten your MySQL root password, you can reset it if you have physical access to the machine mysql is running on: Find the .pid file of the mysql process.
If you have forgotten your MySQL root password, you can reset it if you have physical access to the machine mysql is running on: Find the .pid file of the mysql process. It is either called mysql.pid or machinename.pid. Kill the mysql process. On my MacOS X server e.g. kill cat /usr/local/mysql-standard-4.0.16-apple-darwin6.6-powerpc/data/localhost.pid`` Restart the mysql server /usr/local/mysql-standard-4.0.16-apple-darwin6.6-powerpc/bin/mysqld_safe --skip-grant-tables & Set the new root password (replace newpassword with the new password!) /usr/local/mysql-standard-4.0.16-apple-darwin6.6-powerpc/bin/mysqladmin -u root flush-privileges password "newpassword" Done!