新上线MySQL数据库规划

新上线MySQL数据库规划
1.删除test库
2.删除root用户或者让root用户只可在本机登陆
而对于有业务访问的数据库,在做删除root用户前需要依次确认 function、procedure、event、view、trigger的definer;
有definer为root@%或root@xxx需要将之改为root@127.0.0.1或root@localhost,而且root@localhost或root@127.0.0.1需要被保留,要不然在执行相应的定义时会拒绝执行。

3.最小化生产库上的用户权限

保留root的本地登陆,授权一个具有dba权限的新帐户,业务用户srv_个人账号usr_

业务应用账号:srv开头
grant insert,delete,update,select,execute on prod.* to 'srv_'@'11.150.1.%' identified by 'xxxxxx';
grant all on *.* to ‘dba’@‘%’ identified by ‘xxxxxx’ with grant option;
flush privileges;

从库账号:usr开头,后者禁止访问数据库,通过数据库查询平台(DEV_OPS)查询数据,进行线上问题排查
grant insert,delete,update,select,execute on prod.* to 'usr_'@'11.150.1.%' identified by 'xxxxxx';

原文地址:https://www.cnblogs.com/elontian/p/9154572.html