1. 先到 /Applications/XAMPP/xamppfiles/etc/my.cnf
找
[mysqld],在下面 (Find [mysqld] )
加 skip-grant-tables (insert "skip-grant-tables" below [mysqld])
2. 重啟 (Restart mysql)
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server restart
3. 開 mysql (Enter mysql)
sudo /Applications/XAMPP/xamppfiles/bin/mysql
4. 重設 password (Reset password)
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root'
5. Login (with new password)
sudo /Applications/XAMPP/xamppfiles/bin/mysql -u root -pnew_password -h localhost mysql
6. Reset my.cnf
到 /Applications/XAMPP/xamppfiles/etc/my.cnf , delete "skip-grant-tables"
到 /Applications/XAMPP/xamppfiles/etc/my.cnf , delete "skip-grant-tables"
7. 重啟
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server restart
沒有留言:
張貼留言