mysql5.6
all代表接受所有操作,比如 select,insert,delete....; *.* 代表所有库下面的所有表;% 代表这个用户允许从任何地方登录;为了安全期间,这个%可以替换为你允许的ip地址;
create user test identified by '123456';
grant all privileges on *.* to 'test'@'%'identified by '123456' with grant option;
flush privileges ;
mysql8.0以上
create user test@'%' identified by '123456';
grant all privileges on *.* to test@'%' with grant option;
flush privileges;
出现错误
Unable to load authentication plugin 'caching_sha2_password'.
解决方法
ALTER USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY '123456';