1:蘋果->系統偏好設置->最下邊點mysql 在彈出頁面中 關閉mysql服務mysql
2: Start it in safe modesql
進入終端ui
輸入:spa
cd /usr/local/mysql/bin/code
回車後 登陸管理員權限ip
sudo suterminal
回車後輸入如下命令來禁止mysql驗證功能it
./mysqld_safe --skip-grant-tables &console
3) Open another terminal and run the following command (Keep last terminal open)table
mysql -u root
4) Run the following command with suitable new password on the mysql console
mysql > UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
5) mysql > FLUSH PRIVILEGES;
6) Quit from both terminals and open new terminal and connect to mysql with root user and new password
mysql -uroot -p