<bdo id='suh2R'></bdo><ul id='suh2R'></ul>
    1. <tfoot id='suh2R'></tfoot>
        <legend id='suh2R'><style id='suh2R'><dir id='suh2R'><q id='suh2R'></q></dir></style></legend>

      1. <small id='suh2R'></small><noframes id='suh2R'>

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

        警告:mysqli_connect():未知的 MySQL 服务器主机

        时间:2023-07-29

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

              <bdo id='nyMgO'></bdo><ul id='nyMgO'></ul>
            • <small id='nyMgO'></small><noframes id='nyMgO'>

            • <legend id='nyMgO'><style id='nyMgO'><dir id='nyMgO'><q id='nyMgO'></q></dir></style></legend>

            • <tfoot id='nyMgO'></tfoot>
                <tbody id='nyMgO'></tbody>

                  本文介绍了警告:mysqli_connect():未知的 MySQL 服务器主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在连接到 mysql 服务器时遇到了一些问题.我可以使用 linux 终端连接,所以我知道我的主机、端口、用户和密码有效.但是,我无法使用 PHP 进行连接.

                  PHP 版本: 5.2.17

                  服务器版本: 5.5.27-log MySQL Community Server (GPL)

                  这是一个测试代码示例:

                  给出以下警告:

                  <块引用>

                  警告:mysqli_connect() [function.mysqli-connect]: (HY000/2005): Unknown MySQL server host 'host.com:5306' (1) in/.../test.php on line 3

                  连接失败:未知 MySQL 服务器主机 'host.com:5306' (1)

                  有什么想法可以做什么吗?

                  解决方案

                  端口号必须是一个单独的参数:

                  $link = mysqli_connect('host', 'user', 'pass', 'db', 5306);

                  I have some trouble connecting to a mysql server. I can connect using the linux terminal, so I know that my host, port, user, and password works. I cannot, however, connect using PHP.

                  PHP Version: 5.2.17

                  Server version: 5.5.27-log MySQL Community Server (GPL)

                  Here is a test code example:

                  <?php
                  
                  $link = mysqli_connect('host.com:5306', 'user', 'pass', 'db');
                  
                  /* check connection */
                  
                  if (mysqli_connect_errno()) {
                      printf("Connect failed: %s
                  ", mysqli_connect_error());
                      exit();
                  }
                  
                  if (!mysqli_query($link, "SET a=1")) {
                      printf("Errormessage: %s
                  ", mysqli_error($link));
                  }
                  
                  /* close connection */
                  mysqli_close($link);    
                  
                  ?>
                  

                  Gives the following warning:

                  Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2005): Unknown MySQL server host 'host.com:5306' (1) in /.../test.php on line 3

                  Connect failed: Unknown MySQL server host 'host.com:5306' (1)

                  Any ideas on what to do?

                  解决方案

                  The port number must be a separate argument:

                  $link = mysqli_connect('host', 'user', 'pass', 'db', 5306);
                  

                  这篇关于警告:mysqli_connect():未知的 MySQL 服务器主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:mysqli 持久连接 下一篇:mysqli、OOP 与程序化

                  相关文章

                  最新文章

                  1. <legend id='obkFq'><style id='obkFq'><dir id='obkFq'><q id='obkFq'></q></dir></style></legend>

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

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