OSX修改MYSQL root密码

 

 

打开终端

sudo /usr/local/mysql/support-files/mysql.server stop

sudo /usr/local/mysql/bin/mysqld_safe –skip-grant-tables

打开另一个终端

sudo /usr/local/mysql/bin/mysql -u root

UPDATE mysql.user SET authentication_string=PASSWORD(‘新密码’) WHERE User=’root’;

FLUSH PRIVILEGES;

\q

sudo /usr/local/mysql/support-files/mysql.server restart

*以上方法针对 mysql V5.7.9,

 旧版的mysql请使用:UPDATE mysql.user SET Password=PASSWORD(‘新密码’) WHERE User=’root’;

Leave a Comment

Your email address will not be published.