1. 架构如下
2. 线上数据库创建用户
mysql -uclevercode -pc123456 -h 192.168.2.101 -P 3306
mysql>GRANT ALL PRIVILEGES ON *.* TO 'clevercode'@'192.168.1.*' IDENTIFIED BY 'c123456' WITH GRANT OPTION;mysql>FLUSH RIVILEGES;
3. mysql-proxy安装与配置
# yum list mysql-proxy # yum -y install mysql-proxy
# service iptables stop
[mysql-proxy]
daemon = true
pid-file = /var/run/mysql-proxy.pid
log-file = /var/log/mysql-proxy.loglog-level = debug
max-open-files = 1024plugins = admin,proxy
user = mysql-proxy##Proxy Configuration(代理开发机)proxy-address = 192.168.1.101:3316#线上数据库地址proxy-backend-addresses = 192.168.2.101:3306#proxy-read-only-backend-addresses = #proxy-lua-script = #proxy-skip-profiling = true## Admin Configuration#admin-address = 0.0.0.0:4041admin-lua-script = /usr/lib64/mysql-proxy/lua/admin.lua
admin-username = admin
admin-password = admin
# mysql-proxy --defaults-file=/etc/mysql-proxy.cnf
4. navicat连接
本文经授权后发布,本文观点不代表立场,文章出自:https://blog.csdn.net/clevercode/article/details/52355954