2. 打开终端:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables3. 再新打开另一个新终端:
a、sudo /usr/local/mysql/bin/mysql -u root
b、UPDATE mysql.user SET Password=PASSWORD('root') WHERE User='root';
c、FLUSH PRIVILEGES;
4. 重启MySQL.
2. 打开终端:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tablesa、sudo /usr/local/mysql/bin/mysql -u root
b、UPDATE mysql.user SET Password=PASSWORD('root') WHERE User='root';
c、FLUSH PRIVILEGES;
4. 重启MySQL.