1. <tfoot id='2AH1G'></tfoot>

      <small id='2AH1G'></small><noframes id='2AH1G'>

      <legend id='2AH1G'><style id='2AH1G'><dir id='2AH1G'><q id='2AH1G'></q></dir></style></legend>
        <i id='2AH1G'><tr id='2AH1G'><dt id='2AH1G'><q id='2AH1G'><span id='2AH1G'><b id='2AH1G'><form id='2AH1G'><ins id='2AH1G'></ins><ul id='2AH1G'></ul><sub id='2AH1G'></sub></form><legend id='2AH1G'></legend><bdo id='2AH1G'><pre id='2AH1G'><center id='2AH1G'></center></pre></bdo></b><th id='2AH1G'></th></span></q></dt></tr></i><div id='2AH1G'><tfoot id='2AH1G'></tfoot><dl id='2AH1G'><fieldset id='2AH1G'></fieldset></dl></div>
          <bdo id='2AH1G'></bdo><ul id='2AH1G'></ul>

        通过 SSH 隧道的 MySQL 连接 - 如何指定其他 MySQL 服务器?

        MySQL connection over SSH tunnel - how to specify other MySQL server?(通过 SSH 隧道的 MySQL 连接 - 如何指定其他 MySQL 服务器?)
      1. <small id='TlIPl'></small><noframes id='TlIPl'>

          <tfoot id='TlIPl'></tfoot>

              <bdo id='TlIPl'></bdo><ul id='TlIPl'></ul>

              1. <legend id='TlIPl'><style id='TlIPl'><dir id='TlIPl'><q id='TlIPl'></q></dir></style></legend>
                    <tbody id='TlIPl'></tbody>
                1. <i id='TlIPl'><tr id='TlIPl'><dt id='TlIPl'><q id='TlIPl'><span id='TlIPl'><b id='TlIPl'><form id='TlIPl'><ins id='TlIPl'></ins><ul id='TlIPl'></ul><sub id='TlIPl'></sub></form><legend id='TlIPl'></legend><bdo id='TlIPl'><pre id='TlIPl'><center id='TlIPl'></center></pre></bdo></b><th id='TlIPl'></th></span></q></dt></tr></i><div id='TlIPl'><tfoot id='TlIPl'></tfoot><dl id='TlIPl'><fieldset id='TlIPl'></fieldset></dl></div>
                  本文介绍了通过 SSH 隧道的 MySQL 连接 - 如何指定其他 MySQL 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有大约 50 个数据库都设置在不同的主机名上,要求我通过 SSH 隧道连接到它们.

                  I've got ~50 databases all set up at different host names, with the requirement that I connect to them through an SSH tunnel.

                  例如:

                  • SSH 主机在 ssh.example.com

                  MySQL 主机位于 mysql1.example.com

                  MySQL host at mysql1.example.com

                  我已经设法使用 autossh(运行 Debian 的网络服务器)创建了隧道,但我似乎无法弄清楚如何连接到超出"SSH 隧道的特定 MySQL 主机名.

                  I have managed to create the tunnel using autossh (web server running Debian), but I can't seem to figure out how to connect to a specific MySQL hostname "beyond" the SSH tunnel.

                  输入 lsof -i -n |egrep '\<ssh\>' 确认隧道正在工作(发送端口 3307 到 ssh.example.com 端口 3306)

                  Typing lsof -i -n | egrep '\<ssh\>' confirms that the tunnel is working (sends port 3307 to ssh.example.com port 3306)

                  因此,当我尝试 mysql -h 127.0.0.1 -P 3307 时,连接被拒绝.不太奇怪,因为它不是 MySQL 服务器.

                  So when I try mysql -h 127.0.0.1 -P 3307 I get Connection refused. Not too weird since it's not an MySQL server.

                  我对你们的问题:

                  如何在创建 SSH 隧道后指定 mysql1.example.com 主机?我试过到处搜索,但似乎无法弄清楚.

                  How do I specify the mysql1.example.com host AFTER creating the SSH tunnel? I've tried searching everywhere but can't seem to figure it out.

                  推荐答案

                  解决了!事情是在创建隧道本身时连接到正确的服务器 - 应该已经看到了.

                  Solved it! The thing was to connect to the correct server when creating the tunnel itself - should've seen that one coming.

                  ssh -f user@ssh.example.com -L 3307:mysql1.example.com:3306 -N

                  然后 mysql -h 127.0.0.1 -P 3307 按预期工作.:)

                  Then mysql -h 127.0.0.1 -P 3307 worked as intended. :)

                  这篇关于通过 SSH 隧道的 MySQL 连接 - 如何指定其他 MySQL 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bogus foreign key constraint fail(虚假外键约束失败)
                  how to get last insert id after insert query in codeigniter active record(如何在codeigniter活动记录中插入查询后获取最后一个插入ID)
                  Force InnoDB to recheck foreign keys on a table/tables?(强制 InnoDB 重新检查表/表上的外键?)
                  How to auto generate migrations with Sequelize CLI from Sequelize models?(如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?)
                  Clear MySQL query cache without restarting server(无需重启服务器即可清除 MySQL 查询缓存)
                  ALTER TABLE to add a composite primary key(ALTER TABLE 添加复合主键)
                  <i id='20XaW'><tr id='20XaW'><dt id='20XaW'><q id='20XaW'><span id='20XaW'><b id='20XaW'><form id='20XaW'><ins id='20XaW'></ins><ul id='20XaW'></ul><sub id='20XaW'></sub></form><legend id='20XaW'></legend><bdo id='20XaW'><pre id='20XaW'><center id='20XaW'></center></pre></bdo></b><th id='20XaW'></th></span></q></dt></tr></i><div id='20XaW'><tfoot id='20XaW'></tfoot><dl id='20XaW'><fieldset id='20XaW'></fieldset></dl></div>
                2. <tfoot id='20XaW'></tfoot>
                  • <bdo id='20XaW'></bdo><ul id='20XaW'></ul>

                        1. <legend id='20XaW'><style id='20XaW'><dir id='20XaW'><q id='20XaW'></q></dir></style></legend>
                        2. <small id='20XaW'></small><noframes id='20XaW'>

                              <tbody id='20XaW'></tbody>