create user test_user@'%' identified by 'test2022@';
grant all privileges on test.* to test_user@'%' with grant option;
flush privileges;

这样就可以创建一个叫 test_user 的用户并把密码设置为 test2022@.

同时授予 它 test 数据库的所有表权限

刷新权限规则

如果你要修改远程连接用户的加密规则 可以用这个

alter user test_user@'%' identified with mysql_native_password by '你的密码';
flush privileges;

 如果两次密码不一致,后面的会覆盖前面的