我使用 root 帐户创建的帐户'a'@'%'
。但是我在指定host参数时无法使用该帐户连接到MySQL服务器。我可以不带-h
参数成功连接。请看下面的文字记录。我希望有人能帮我解释一下。谢谢。
mysql> grant all on *.* to 'a'@'%' identified by a;
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 'a' at line 1
mysql> grant all on *.* to 'a'@'%' identified by 'a';
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for 'a'@'%';
+-----------------------------------------------------------------------------------------------------------+
| Grants for a@% |
+-----------------------------------------------------------------------------------------------------------+
| GRANT …
Run Code Online (Sandbox Code Playgroud)