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

 

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

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

2.同上面目录下执行sql

update mysql.user set authentication_string=PASSWORD\(\'123'\) where User='root';
-- 注意 括号旁边转义符号不能少,否则报错以下
-bash: syntax error near unexpected token `('
相关文章
相关标签/搜索