Mac で MySQL パスワードを変更できない

Mac で MySQL パスワードを変更できない

MySQLのパスワードを忘れました。私はGoogleのほぼすべての方法に従いました。しかし、まだMySQLのパスワードを変更することはできません。コマンドを正しく作成しました。これは何の問題ですか?私は本当に知らない。 ERROR 1064 (42000)このエラーコードは私を怒らせます。

私が使用するコマンドは次のとおりです。

mysql> use mysql;
Database changed
mysql> update user set password=password('xxxx') where user='root';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('xxxx') where user='root'' at line 1
mysql> set password for 'root' = password('xxxx');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('xxxx')' at line 1
mysql> 

ベストアンサー1

バラよりhttps://dev.mysql.com/doc/refman/8.0/en/set-password.html

MySQLはパスワードを関数として使用してユーザーを窒息させます。

正しい構文は次のとおりです。

set password for 'root' = 'xxxx'

これにより root@% のパスワードが設定されます。ホストを指定する必要があります。

set password for 'root'@localhost = 'xxxx'

最新のMySQLでは、パスワードが暗号化されています。

おすすめ記事