mysql8.0创建用户授予权限报错解决方法

Error Code: 1064. 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 ‘11111” at line 1;

会报错的写法:
CREATE USER ‘w’@’localhost’ IDENTIFIED BY ‘000000’;
GRANT ALL PRIVILEGES
ON .
TO ‘w’@’localhost’
IDENTIFIED BY ‘000000’;

以下是正确的写法:

create user ‘tom’@’localhost’ identified by ‘123123’;
grant all privileges on . to ‘tom’@’localhost’ ;

可见,在授权的语句中需要去掉
IDENTIFIED BY ‘password’;

单独授予某种权限的写法:
GRANT SELECT
ON oilsystem.input
TO ‘u5’@’localhost’

刷新权限并查看权限的写法:
FLUSH PRIVILEGES;
select * from user;

注意:在创建用户前需要加一句
Use mysql;

另外,收回某种权限的写法是:
REVOKE select
ON .
FROM ‘u1’@’localhost’;

原文:https://blog.csdn.net/skyejy/article/details/80645981

你可能感兴趣的:(mysql8.0创建用户授予权限报错解决方法)