mac os x 下mysql重置密码
操作系统:max os x 10.11.4
mysql版本:14.14
重置密码操作方式:
停止服务: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
重置密码:$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root'; # 其中my_password为新密码。
(如果提示unknown "Password" field error,用下面这个命令)
UPDATE USER SET AUTHENTICATION_STRING=password('my_password') WHERE user='root';
刷新权限:$mysql> FLUSH PRIVILEGES;
退出mysql:$mysql> EXIT
关闭mysql服务:sudo /usr/local/mysql/support-files/mysql.server stop
正常启动mysql服务:通过系统偏好设置-》Mysql-》启动