目录
一、问题:
二、原因:
三、解决方法:
四、拓展:
使用下列授权语句:
grant all privileges on mortal.* to 'xiaoqi'@'localhost' identified by 'mortalz7' with grant option;
【mortal:数据库名 xiaoqi:用户名 localhost:主机名 mortalz7:密码】
遇到如下问题:
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 'mortalz7' with grant option' at line 1
ERROR 1064(42000):你的SQL语法有错误;查看与MySQL服务器版本对应的手册,在第1行'identified by 'mortalz7' with grant option'附近使用正确的语法
(1)首先是否有中文字符,确保所有字符全为英文。
(2)重新执行语句,如还是遇到同样问题,使用如下方法解决:
先创建用户,再授权
创建用户xiaoqi
create user 'xiaoqi'@'localhost' identified by 'mortalz7';
【创建时遇到ERROR 1819 (HY000): Your password does not satisfy the current policy requirements问题,请查看http://t.csdnimg.cn/fp7tZ】
授权:
grant all privileges on mortal.* to 'xiaoqi'@'localhost' with grant option;
刷新权限:
flush privileges;
查看授权
show grants for 'xiaoqi'@'localhost';
删除用户:
drop user 'xiaoqi'@'localhost';