用户为testuser,配置100.%.%.%,192.%.%.%,127.%.%.%三个ip段可访问。
因为数据库通过了本地nginx使用127.0.0.1:3306做过反向代理,所以127.0.0.1也需要白名单才能被代理方访问。
GRANT ALL ON *.* TO 'testuser'@'100.%.%.%' identified by '123456';
GRANT ALL ON *.* TO 'testuser'@'192.%.%.%' identified by '123456';
GRANT ALL ON *.* TO 'testuser'@'127.0.0.1' identified by '123456';
OPTIMIZE TABLE user;
flush privileges;