MySQL 8.0已经不支持下面这种命令写法
grant all privileges on *.* to root@"%" identified by ".";
正确的写法是先创建用户
CREATE USER 'root'@'%' IDENTIFIED BY 'yourpassword';'
再给用户授权
grant all privileges on *.* to 'root'@'%' ;
PS:如果Navicat连接远程数据库报1251的错误
原因: mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password。
方法1:升级navicat
方法2:mysql用户登录密码加密规则还原成mysql_native_password
#查看plugin
select host,user,plugin,authentication_string from mysql.user;
#修改加密规则
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'yourpassword';