我遇到错误一: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;我遇到的错误二:Error Code: 1396. Operation CREATE USER failed for ‘u10’@’localhost’
会报错的写法:
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;
(这些都是我今晚踩了很多坑总结出来的血泪教训……)