MySQL在grant时报错ERROR 1064 (42000)
网上查到的grant方式大多会报错,主要原因是MySQL版本8.0后不能再使用原来的方式
- 查询MySQL版本
SELECT version();
- 在8.0版本下
grant all privileges on test.* to test@'%' 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
- 正确的grant方式
create user test@'localhost' identified by '123456';
grant all privileges on test.* to test@'localhost';
flush privileges;
- MySQL8.0密码登录不上
alter user test@'localhost' identified with mysql_native_password by '123456';
浙公网安备 33010602011771号