创建用户只允许本地IP访问
create user 'lyy'@'localhost' identified by '123456';
创建用户允许外围访问
create user 'lyy'@'%' identified by '123456';
执行刷新授权
flush privileges;
授予用户通过外网操作某一个数据库所有权限
grant all privileges on `testdb`.* to 'lyy'@'%' identified by '123456';
授予用户外网操作所有数据库权限
grant all privileges on `*.*`.* to 'lyy'@'%' identified by '123456';