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

    <small id='iVZhd'></small><noframes id='iVZhd'>

    1. <tfoot id='iVZhd'></tfoot>

      1. Zend_Db:如何通过 SSH 隧道连接到 MySQL 数据库?

        时间:2023-10-02

        <small id='cpCub'></small><noframes id='cpCub'>

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

                    <tbody id='cpCub'></tbody>
                1. <legend id='cpCub'><style id='cpCub'><dir id='cpCub'><q id='cpCub'></q></dir></style></legend>
                  本文介绍了Zend_Db:如何通过 SSH 隧道连接到 MySQL 数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何使用 PHP 和 Zend 框架连接到需要 SSH 隧道的 MySQL 数据库?

                  How can I connect to a MySQL database that requires an SSH tunnel using PHP and the Zend Framework?

                  推荐答案

                  只需启动 SSH 隧道并使用本地端口作为您的 MySQL 端口.

                  Just start up SSH tunnel and use the local port as your MySQL port.

                  例如,您像这样启动隧道,

                  For example, you start tunnel as this,

                  ssh -f user@mysql-server.com -L 3306:mysql-server.com:3306 -N
                  

                  你可以像这样连接到 MySQL,

                  And you can connect to MySQL like this,

                  $conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
                  

                  对于 zend_db,你这样做,

                  For zend_db, you do this,

                  $config = new Zend_Config(
                      array(
                          'database' => array(
                              'adapter' => 'Mysqli',
                              'params'  => array(
                                  'host'     => 'localhost',
                                  'dbname'   => 'my_db',
                                  'username' => 'mysql_user',
                                  'password' => 'mysql_password',
                              )
                          )
                      )
                  );
                  
                  $db = Zend_Db::factory($config->database);
                  

                  这篇关于Zend_Db:如何通过 SSH 隧道连接到 MySQL 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:学说 2 和 Zend 分页器 下一篇:Zend_Log in application.ini

                  相关文章

                  最新文章

                2. <tfoot id='811Ju'></tfoot>

                  <small id='811Ju'></small><noframes id='811Ju'>

                      • <bdo id='811Ju'></bdo><ul id='811Ju'></ul>
                      <legend id='811Ju'><style id='811Ju'><dir id='811Ju'><q id='811Ju'></q></dir></style></legend>
                    1. <i id='811Ju'><tr id='811Ju'><dt id='811Ju'><q id='811Ju'><span id='811Ju'><b id='811Ju'><form id='811Ju'><ins id='811Ju'></ins><ul id='811Ju'></ul><sub id='811Ju'></sub></form><legend id='811Ju'></legend><bdo id='811Ju'><pre id='811Ju'><center id='811Ju'></center></pre></bdo></b><th id='811Ju'></th></span></q></dt></tr></i><div id='811Ju'><tfoot id='811Ju'></tfoot><dl id='811Ju'><fieldset id='811Ju'></fieldset></dl></div>