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 `('
相關文章
相關標籤/搜索