打开远程访问,登录Mysql 后执行:
grant all privileges on ssss.* to root@"%" identified by "sssss" with grant option;
第一个ssss 代表数据库名,如果你用*表示所以数据库,最好指定你只想暴露到外网的。
有时候为了安全又想关闭:
先查询一下:
select user,host from user where user = "root" and host= "%";
flush privileges;
如果有记录:
delete from user where user = "root" and host= "%";
flush privileges;
补充一点,对存储过程的权限:
grant ALTER ROUTINE,CREATE ROUTINE on sss.* to 'sss'@'%';
flush privileges;
上面代表给用户sss设置数据库sss的创建,修改存储过程权限。
grant all privileges on ssss.* to root@"%" identified by "sssss" with grant option;
第一个ssss 代表数据库名,如果你用*表示所以数据库,最好指定你只想暴露到外网的。
有时候为了安全又想关闭:
先查询一下:
select user,host from user where user = "root" and host= "%";
flush privileges;
如果有记录:
delete from user where user = "root" and host= "%";
flush privileges;
补充一点,对存储过程的权限:
grant ALTER ROUTINE,CREATE ROUTINE on sss.* to 'sss'@'%';
flush privileges;
上面代表给用户sss设置数据库sss的创建,修改存储过程权限。