首页 > 解决方案 > 无法在 MySQL 中对用户进行 GRANT SELECT

问题描述

我最初发布了一个关于为什么我在这里收到语法错误消息的问题。然后我创建了用户usermail(我承认我误用了IDENTIFIED BY,但我认为在这种情况下并不重要:

mysql> CREATE USER 'usermail'@'127.0.0.1' IDENTIFIED BY 'usermail';
Query OK, 0 rows affected (0.02 sec)

然后我重试了我最初尝试运行的内容。

mysql> GRANT SELECT ON servermail.* TO 'usermail'@'127.0.0.1' IDENTIFIED BY 'mailpassword';
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 'IDENTIFIED BY 'mailpassword'' at line 1
mysql> GRANT SELECT ON servermail.* TO 'usermail' IDENTIFIED BY 'mailpassword';
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 'IDENTIFIED BY 'mailpassword'' at line 1
mysql> GRANT SELECT ON servermail.* TO 'usermail'@'127.0.0.1' IDENTIFIED BY 'mailpassword';

我仍然收到完全相同的错误。我的问题怎么重复了?还是我没有正确遵循指示?

标签: mysqlsyntaxprivilegesgrant

解决方案


推荐阅读