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';