How to change root password Mysql on Mac

First, Stop mysql server

$ mysql.server stop

Then start mysqld_safe

$ cd /usr/local/Cellar/mysql/5.7.16/bin

$ mysqld_safe –skip-grant-tables &

Connect mysql with root user

$ mysql -uroot mysql

etc) behind mysql is a database name.

Update password of root user. (I’m using a 5.7.16 mysql, you have to use ‘password’ column instead of ‘authentication_string’ column in previous version.)

$ update user set authentication_string=password([changed_password]) where user=’root’;

Flush previleage and quit

$ flush privileges;

$ quit

And then check if it is changed correctly.

$ mysql.server start

$ mysql -uroot -p

Enter password: [type a changed password]

If you connect mysql, your password changed correctly.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s