Development

David Carr

Changing default mysql password for MySQL 5.7 on a Mac

Today’s I’ve reinstalled my os and decided to install mysql in terminal I didn’t make a note of the temp password, so when I tried to run mysql I get access denied. The password needed changing these are the steps I followed.

Turn off mysql from system preferences – MySQL

In terminal type: 

sudo mysqld_safe --skip-grant-tables

This starts safe mode then enter as root:

mysql -u root

Change the password for root: in my case I’ve using root as the password.

UPDATE mysql.user SET authentication_string=PASSWORD('root') WHERE User='root';

the output should read:

Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

then exit safe mode by typing:

exit;

Now you should be able to login to mysql using the username and password of root.

Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2021 DC Blog. All code MIT license. All rights reserved.