私はかなり長い間この問題に直面してきました。実際にインストールされたphpとmysqlにxamppをインストールしました。mysql には常にデフォルトのユーザー root (パスワードなし) が付属しています。root(パスワードなし)を使用してログインできますが、何もできません。任意のデータベースを使用し、任意のテーブルを選択し、パスワードを変更します..これらの操作を実行できません。メッセージを取得しようとすると
mysql> use mysql
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
mysql>
ここで行った手順をお見せしましょう..
ログイン成功。
C:\xampp\mysql\bin>mysql.exe -u root;
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
これを実行してユーザーリストを表示しました
mysql> select user();
+-----------------+
| user() |
+-----------------+
| root;@localhost |
+-----------------+
1 row in set (0.00 sec)
私もこれを実行しました
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| @localhost |
+----------------+
1 row in set (0.00 sec)
root@localhost として表示されない理由がわかりません。正しい方法ですか?
次に、興味深いことに、以下のメッセージが表示されます
mysql> show grants;
+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)
Grant USAGE ... そうですか?
DBから何かをするのを止めただけです。