In MySQL, by default, the username is root and there’s no password.

If during the installation process, you accidentally put a password in and don’t remember, here is how to reset the password:

  • Stop the MySQL server if it is running, then restart it with the –skip-grant-tables option.
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

It allows you to connect without a password and with all privileges and disables account-management statements such as ALTER USER and SET PASSWORD, which will be used later on to reset password. --skip-networking is enabled to automatically to prevent remote connections since it’s very insecure.

  • Then connect to the MySQL Server using the mysql client:
 mysql -u root
  • Then run this command to reload the grant tables:
  • Now you can be able to set a new password for the root account:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

It’s done, stop the server and restart it normally. Now you can connect to the MySQL Server with the new password.

Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.

Download TablePlus for Mac. It’s free anyway!

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS.

TablePlus GUI Tool MySQL