1、mysql 添加用户访问权限
grant all on *.* to 'root'@'192.168.0.%' identified by 'root';
grant all on db1.b1 to '用户'@'%' identified by '密码';
授权root用户可以在任何 % ip下对db1数据库的b1表进行访问
2、添加增、删、改、查权限,授权本机操作权限
grant select ,insert ,update,delete on *.* to 'root'@'192.168.0.%' identified by 'root';
grant select,insert,update,delete,create,drop,alter on 数据库.* to 用户@'127.0.0.1' identified by '密码';
3、数据库主从备份,添加从库复制权限
grant replication slave on *.* to 'slave'@'192.168.1.%' identified by '123456';
4、添加操作权限,允许该数据库开启远程访问的权限
grant all privileges on 数据库.* to 用户@localhost identified by "密码" ;
grant all privileges on *.* to 'root'@'%' identified by '123456'
这里的123456为你给新增权限用户设置的密码,root用户 在 %代表所ip条件下 可以操作数据库
5、授权完记得刷新
FLUSH PRIVILEGES;