问题一:
会报错的写法:
GRANT ALL PRIVILEGES ON *.* ‘root'@'%' identified by ‘123123' WITH GRANT OPTION;
以下是正确的写法:
grant all privileges on *.* to ‘root'@'%' ;
可见,在授权的语句中需要去掉
IDENTIFIED BY ‘password';
单独授予某种权限的写法:
GRANT SELECT
ON oilsystem.input
TO ‘u5'@'localhost'
刷新权限并查看权限的写法:
FLUSH PRIVILEGES;
select * from user;
注意:在创建用户前需要加一句
Use mysql;
另外,收回某种权限的写法是:
REVOKE select
ON .
FROM ‘u1'@'localhost';
问题二:
Mysql远程连接报错:authentication plugin caching_sha2
mysql 8.0 默认使用 caching_sha2_password 身份验证机制 —— 从原来的 mysql_native_password 更改为 caching_sha2_password。
从 5.7 升级 8.0 版本的不会改变现有用户的身份验证方法,但新用户会默认使用新的 caching_sha2_pa