mysql8版本执行 grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
会报语法错误 ERROR 1064 (42000)
应先创建新用户
create user 'admin'@'%' identified by 'password';
执行授权
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%';
刷新
flush privileges;
授权远程
ALTER USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
刷新
flush privileges;