当我尝试在mySQL上授予用户特权时,发生了错误。我在命令行上键入错误吗?
x86_64上的macOS10.14的mySQL Ver 8.0.16(MySQL社区服务器-GPL)。
mysql>grant all privileges on librarydb.* to 'phill'@'%' identified by '123456';
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 '123456'' at line 1.
答案 0 :(得分:0)
您的MySQL是什么版本?如果是5.7或更高版本,则可能与此问题相同:
答案 1 :(得分:0)
下一条命令
mysql>grant all privileges on librarydb.* to 'phill'@'%' identified by '123456';
应更改为:
mysql> create user 'phill' identified by '123456';
mysql> grant all privileges on librarydb.* to 'phill';
如果尚未创建“ phill”用户。如果它是早先创建的,则使用alert
代替create