Mac mysql 忘记root密码的解决方法

 

1.执行命令以安全模式启动MySQL

cd /usr/local/mysql/bin
sudo ./mysqld_safe --skip-grant-tables

2.同上面目录下执行

update mysql.user set authentication_string=PASSWORD\(\'123'\) where User='root';
-- 注意 括号旁边转义符号不能少,不然报错如下
-bash: syntax error near unexpected token `('

 

posted @ 2019-07-22 14:16  残阳飞雪  阅读(293)  评论(0编辑  收藏  举报