浅析:

具体部署:mysql服务器:

#授权远程登录账户

[root@localhost ~]# mysql -uroot  -pmysql> GRANT ALL ON *.* to 'test'@'192.168.0.1' IDENTIFIED BY 'lmdb(A7105#B9606@com!';mysql> flush privileges;mysql> select user,host from mysql.user;+---------------+----------------+| user          | host           |+---------------+----------------+| root          | 127.0.0.1      || zabbix        | 127.0.0.1      || test          | 192.168.0.1    || root          | localhost      |+---------------+----------------+11 rows in set (0.00 sec)mysql> quit

#防火墙开放数据库的端口,或者关闭防火墙

a。关闭防火墙

[root@localhost ~]# systemctl status iptables#    systemctl stop iptables● iptables.service - IPv4 firewall with iptablesLoaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)Active: inactive (dead) since Tue 2019-08-13 15:43:07 CST; 1 weeks 1 days agoMain PID: 1969 (code=exited, status=0/SUCCESS)

b。防火墙规则

[root@localhost ~]# vim /etc/sysconfig/iptables-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT[root@localhost ~]#  ystemctl restart iptablesmysql-proxy服务器

#下载mysql-proxy包

wget https://downloads.mysql.com/archives/get/file/mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit.tar.gz

#安装

[root@e test]# tar zxf mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit.tar.gz -C /usr/local/cd /usr/local/[root@e local]# lsmysql-proxy-0.8.5-linux-glibc2.3-x86-64bit[root@e local]# mv mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit/   mysql-proxy[root@e local]# lsmysql-proxy[root@e local]# mkdir /usr/local/mysql-proxy/{conf,log} -p[root@e mysql-proxy]# tail -3 /etc/profile#(添加下面三行内容)LUA_PATH="/usr/local/mysql-proxy/share/doc/mysql-proxy/?.lua"export LUA_PATHexport PATH=$PATH:/usr/local/mysql-proxy/bin[root@e mysql-proxy]# source /etc/profile

[root@e conf]# vi mysql-proxy.conf[mysql-proxy]user=wwwdaemon=truekeepalive=trueplugins=proxy,admin###日志级别log-level=infolog-file=/usr/local/mysql-proxy/log/mysql-proxy.log###本机ip地址proxy-address=14.152.90.6:9196         #本地的ip和代理端口,后期navicat连接使用的地址##backend主   注意addressesproxy-backend-addresses=192.168.0.2:3306      #mysql的内网ip地址##proxy的管理用户admin的IP和端口admin-address=192.168.0.1:9197               #mysql-proxy的内网###下面的三个参数必须设定,否则mysql-proxy服务启动不了的admin-username=test1admin-password=test1###admin的lua脚本地址;admin-lua-script=/usr/local/mysql-proxy/lib/mysql-proxy/lua/admin.lua

#启动

[root@e conf]# chmod 660 mysql-proxy.conf[root@e conf]# /usr/local/mysql-proxy/bin/mysql-proxy --defaults-file=/usr/local/mysql-proxy/conf/mysql-proxy.conf[root@e conf]# netstat -luntpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program nametcp        0      0 14.152.90.6:9196        0.0.0.0:*               LISTEN      11502/mysql-proxytcp        0      0 192.168.0.1:9197        0.0.0.0:*               LISTEN      11502/mysql-proxy

#登陆mysql-proxy管理账户,查看代理管理列表

[root@e bin]# mysql -utest1  -ptest1  -h192.168.0.1  --port=9197Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.0.99-agent-adminCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> SELECT * FROM backends;+-------------+------------------+---------+------+------+-------------------+| backend_ndx | address          | state   | type | uuid | connected_clients |+-------------+------------------+---------+------+------+-------------------+|           1 | 192.168.0.2:3306 | unknown | rw   | NULL |                 0 |+-------------+------------------+---------+------+------+-------------------+1 row in set (0.00 sec)mysql> SELECT * FROM help;+------------------------+------------------------------------+| command                | description                        |+------------------------+------------------------------------+| SELECT * FROM help     | shows this help                    || SELECT * FROM backends | lists the backends and their state |+------------------------+------------------------------------+2 rows in set (0.00 sec)mysql> quit

#远程连接mysql

[root@e bin]# mysql -utest -p'lmdb(A7105#B9606@com!'  -h 192.168.0.2Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 223226Server version: 5.7.27-log MySQL Community Server (GPL)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || CodeDB             || mysql              || mysqldata          || performance_schema || sys                |+--------------------+6 rows in set (0.00 sec)mysql> quit######################成功######################

#防火墙规则(通过navicat,sqlyog等工具连接数据库的时候,当然需要开放本地的代理端口)

a。关闭防火墙

[root@localhost ~]# systemctl status iptables# systemctl stop iptables● iptables.service - IPv4 firewall with iptablesLoaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)Active: inactive (dead) since Tue 2019-08-13 15:43:07 CST; 1 weeks 1 days agoMain PID: 1969 (code=exited, status=0/SUCCESS)

b。添加防火墙规则

[root@localhost ~]# vim /etc/sysconfig/iptables-A INPUT -p tcp -m tcp --dport 9196 -j ACCEPT[root@localhost ~]#  ystemctl restart iptables

mysql代理服务器_mysql-proxy代理同一内网的数据库相关推荐

  1. Java实现Http代理服务器通过http代理进行内网安装yum软件

    Java实现Http代理服务器&通过http代理进行内网安装yum软件 1.Http代理服务器简介 2.Http代理服务器Java实现 2.1 Java源码 2.2 代码分析说明 3.通过ht ...

  2. 端口转发与代理工具 内网代理 内网反弹代理

    目录 一.LCX 二.nc 反弹 三.socks代理工具 四.frp 内网穿透利器 五.ngrok 内网穿透 理论上,任何接入互联网的计算机都是可访问的,但是如果目标主机处于内网,而我们又想和该目标主 ...

  3. 红蓝对抗之隧道技术第一篇(内网穿透、端口映射端口转发、Netsh端口转发、CS正反向连接多层内网、Burp设置上游代理访问内网、MSF protfwd端口转发/重定向)

    文章目录 隧道应用 端口映射&端口转发 Netsh端口转发 Netsh端口转发meterpreter CS正向连接多层内网 CS反向连接多层内网 Burp设置上游代理访问内网 MSF prot ...

  4. ssh代理登录内网服务器

    ssh代理登录内网服务器 服务器 192.168.48.81 # client 192.168.48.82 # bastion 192.168.48.83 # private password方式 1 ...

  5. 利用EW代理实现内网穿透

    利用EW代理实现内网穿透 环境: 攻击机:kali ip192.168.32.132 中间机:win7 ip 192.168.32.128 ip2 192.168.1.3 假定为公网vps 内网主机: ...

  6. 宿主机使用虚拟机中的全局代理访问内网

    如何让宿主机使用虚拟机中的全局代理访问内网 背景 方法 配置VirtualBox 虚拟机下网络配置 最后的操作 背景 因为公司使用的 VPN 只有 Windows 客户端,所以只好在虚拟机中的 Win ...

  7. mysql无法连接内网的数据库

    当只有内网的数据库地址时,直接通过Navicat添加mysql是无法链接上的. 那怎么办呢? 如果你能知道内网链接的服务器地址账号和密码, 那么可以在Navicat先将数据库的内容填写好: 然后进入到 ...

  8. 信创环境下Nginx正向代理实现内网发送邮件

    背景 标题党了,其实不管是不是在信创环境,只要存在网络分区/隔离,我们都可能面临发送邮件的问题: 业务服务要发送邮件但是部署在无法连接互联网的环境A中: Nginx一方面作为静态资源服务,另一方面作为 ...

  9. 如何在外网访问内网服务器数据库?

    一.首先直接抛出常用的问题:    1.如何在外网访问内网服务器数据库?    2.如何在外网访问无公网的云服务器数据库?    3.如何在外网访问服务器集群中的多个异构数据库?    4.如何提高远 ...

最新文章

  1. C语言有以下几种取整方法:
  2. C/C++中的typedef 和 #define
  3. 18100出多少取整_关于JavaScript数据类型,你知道多少?
  4. 老外用的文件服务器,云存储服务市场乱战 老外到底都用啥
  5. 语音识别技术是什么_语音识别技术应用领域介绍
  6. fastdfs上传文件_Java 实现 FastDFS 实现文件的上传、下载、删除
  7. Launch MySQL on my PC
  8. InDesign 软件教程,如何自定义工作区?
  9. KVM虚拟化笔记(十)------kvm虚拟机扩充磁盘空间
  10. Gambit 4.运行时选项
  11. pilz pnoz s4说明书_如何使用Pilz的安全继电器PNOZ S4?
  12. 启动react-native报错 Unrecognized font family 'Ionicons'
  13. Flutter的原理及美团的实践(下,100%好评
  14. 精准关键词获取-行业搜索词分析
  15. 绝了,SpringBoot引入 Dataway,无需开发任何代码配置一个满足需求的接口!
  16. android 网易新闻 详情页面实现,Android实现网易新闻客户端首页效果
  17. python四位水仙花数代码_Python一句代码实现找出所有水仙花数的方法
  18. arm开发板移植ALSA库与ALSA工具
  19. 不可告人的隐私百度云_理解围绕软件技术标准的不可告人的动机和力量
  20. 牛客小白月赛32--C消减整数、E春游(贪心)

热门文章

  1. 机器人操作系统ROS Indigo 入门学习(18)——ROS wiki导航
  2. spring cloud alibaba 全家桶详细整合
  3. linux 命令客户端,linux 网络客户端命令
  4. 诚龙网刻报错_网刻工具|诚龙网维全自动PXE网刻工具V11.0下载(暂未上线)_预约_飞翔下载...
  5. 巴菲特致股东的一封信:2010年
  6. python selenium下载_Python Selenium安装下载
  7. 拓展全球领域iebook超级精灵与国际巨头合作走向新市场
  8. Java小白入门第十五弹 酒店管理系统(实例一)
  9. 让你思维洞开的5个头脑风暴工具
  10. 做单:第十章 洗脑的成交