Mysql on MAC El Capitan OS, Sierra OS. How to set reset new root password

mysql server mac

If you don't remember or need to reset mysql password on your mac , follow these steps:

1.Stop mysql server.
2. Open terminal and paste code below. It will run the server in safe mode with privilege bypass.

sudo mysqld_safe --skip-grant-tables

3. Open new terminal. Paste code below.

mysql -u root

4. For MySQL older than MySQL 5.7 use:

UPDATE mysql.user SET Password=PASSWORD('new-password') WHERE User='root';

For MySQL 5.7+ use:

UPDATE mysql.user SET authentication_string=PASSWORD("new-password") WHERE User='root';

5. Now flush the permissions & quit.

FLUSH PRIVILEGES;
q

Hope it helps. Share if you like.

Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *