hanshileiai
7/12/2018 - 7:53 AM

mysql 更新远程用户为特定IP 访问

mysql 更新远程用户为特定IP 访问

创建远程访问用户

CREATE USER 'test_user'@'%' IDENTIFIED BY 'test_user_password';
GRANT ALL PRIVILEGES ON  *.*  TO test_user@'%';
flush privileges;

创建 mysql 用户

CREATE USER 'slave'@'localhost' IDENTIFIED BY 'user1_password';

mysql 更新远程用户为特定IP 访问

RENAME USER `slave`@`%` TO `slave`@`xx.xx.xx.xx`;
flush privileges;

用户授权数据库

GRANT ALL PRIVILEGES ON  test_db.*  TO slave@'xx.xx.xx.xx';
flush privileges;