Featured image of post MySQL 設定root密碼

MySQL 設定root密碼

我自己是用第一行成功的其他會出現錯誤,在password附近,其他也紀錄說不定是我哪個地方沒有用好而已。

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

UPDATE user SET authentication_string=password('new_password') WHERE user='root';

延伸閱讀: 登入 MySQL localhost 錯誤 Source: ERROR 1064 (42000): You have an error in your SQL syntax; Want to configure a password as root being the user  

Licensed under CC BY-NC-SA 4.0