简体   繁体   English

(HY000/2005):未知 MySQL 服务器主机“fdb32.awardspace.net:3306”(-2)连接失败:未知 MySQL 服务器主机“fdb32.awardspace.net:3306”(-2)

[英](HY000/2005): Unknown MySQL server host 'fdb32.awardspace.net:3306' (-2) Connection failed: Unknown MySQL server host 'fdb32.awardspace.net:3306' (-2)

Hi all I a new to sql so I apologise in advance.大家好,我是 sql 的新手,所以我提前道歉。 My link is http://suteki.atwebpages.com/test.php and the error I keep getting is我的链接是http://suteki.atwebpages.com/test.php我不断收到的错误是

Warning: mysqli::__construct(): (HY000/2005): Unknown MySQL server host 'fdb32.awardspace.net:3306' (-2) in /srv/disk20/4134947/www/suteki.atwebpages.com/connect.php on line 8. Connection failed: Unknown MySQL server host 'fdb32.awardspace.net:3306' (-2)警告:mysqli::__construct(): (HY000/2005): 未知 MySQL 服务器主机 'fdb32.awardspace.net:3306' (-2) 在 /srv/disk20/4134947/www. php 在第 8 行。连接失败:未知 MySQL 服务器主机 'fdb32.awardspace.net:3306' (-2)

I am using awardspace and I have all the details correct for port and host db name etc. but this is driving me up the wall.我正在使用awardspace,并且端口和主机数据库名称等的所有详细信息都正确无误,但这让我难以接受。 I have searched online and every other similar error found does not relate to my problem.我在网上搜索过,发现的所有其他类似错误都与我的问题无关。 My connect.php is as posted below:我的 connect.php 发布如下:

><?php
>$servername = "fdb32.awardspace.net:3306";
>$username = "4134947_suteki";
>$password = "m;4bSu+p4!}Sn/o9";
>$dbname = "4134947_suteki";

>// Create connection
>$conn = new mysqli($servername, $username, $password, $dbname, 3306);
>// Check connection
>if ($conn->connect_error) {
>die("Connection failed: " . $conn->connect_error);
>} 
>?>

My test.php is as follows:我的test.php如下:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="description" content="This is a Japanese Restaurant website">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@600&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@300&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="main.css">
    <link rel="icon" href="https://stpierres.co.nz/images/20190329151614.png"/>
    <title>素てきSuteki Test</title>
    <style>
    .orderHere {
        display: inline-block;
        width: 70%
}


     #orderH {
        display:flex;
        flex-direction: row;
        flex-wrap: wrap;
}
        </style>  
  </head>
 
 <body style="background-color:black";>
  
    <div class="box banner">
      <h1><a href="index.php">素 て き</a></h1>
    </div>


    <!-- navigation -->
    <div class="box nav">
      <a href="index.php">HOMEPAGE</a>
      <a href="menu.php">MENU</a>
      <a href="order.php">ORDER</a>
      <a href="contactus.php">CONTACT US</a>
      <a href="test.php">TEST</a>
    </div>

   
    <!--main content-->
    
    <div class="content">
       
    <h1>Database</h1>
    
      <?php 
      
              require_once 'connect.php';
              
              $sql = "SELECT menu.*, order_total.* FROM menu, order_total WHERE menu.menu_id = order_total.menu_id";
              
              $result = $conn->query($sql);
              
              echo '<h1 class="orderHere">Order Here</h1>';
              
              echo '<section id="orderH">';
              
                      if($result->num_rows > 0){ 
                              while($row = $result->fetch_assoc()){
                                      echo '<article>';
                                      
                                              echo '<h2>' . $row["Title"] . '</h2>';
                                              
                                              echo '<figure><img src=' . $row["Image"] . ' height="150" width="150"> </figure>';
                                              
                                              echo '<p><span id="title">Menu Item: </span><span>'. $row["item_title"] . '</span></p>';
                                              echo '<p><span id="title">Description: </span><span>'. $row["description"] . '</span></p>';
                                              echo '<p><span id="title">Menu Item: </span><span>'. $row["item_title"] . '</span></p>';                                 
                                              echo '<p><span id="title">Price: </span><span>'. number_format((float)$row["price"], 2, '.', '') . '</span></p>';
                                      
                                      echo '</article>';
                              }
                        }
               echo '</section>';
              
      ?>
      
</div>
  </body>

Any help would be greatly appreciated - thank you kindly.任何帮助将不胜感激 - 非常感谢您。

Its the same person (cinnamon).它是同一个人(肉桂)。 I forgot my log in details.我忘记了我的登录详细信息。

Anyway, thanks so much for your assistance.无论如何,非常感谢您的帮助。 I have changed my connect.php accordingly, however its still not playing nice我已经相应地改变了我的connect.php,但是它仍然不能很好玩

connect_error) { die("Connection failed: ". $conn->connect_error); connect_error) { die("连接失败:".$conn->connect_error); }?> }?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQLSTATE[HY000] [2005] 未知 MySQL 服务器主机 &#39;mysql1.alwaysdata.com:3306&#39; (2) - SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql1.alwaysdata.com:3306' (2) SQLSTATE[HY000] [2005] 未知 MySQL 服务器主机 'localhost:3306' (2) - SQLSTATE[HY000] [2005] Unknown MySQL server host 'localhost:3306' (2) 无法通过 docker 容器中的 Jyputer 读取 mysql(错误:DatabaseError: 2005 (HY000): Unknown MySQL22 服务器主机') - Unable to read mysql through Jyputer in docker containers (error: DatabaseError: 2005 (HY000): Unknown MySQL server host 'localhost:3306' (22)) SQLSTATE [HY000] [2005] Laravel中未知的MySQL服务器主机&#39;&#39;(2) - SQLSTATE[HY000] [2005] Unknown MySQL server host ' ' (2) in Laravel ERROR 2005(HY000):aws中未知的MySQL服务器主机 - ERROR 2005 (HY000): Unknown MySQL server host in aws 错误2005(HY000):未知的MySQL服务器主机“学生”(0) - ERROR 2005 (HY000): Unknown MySQL server host 'students' (0) 错误2005(HY000):未知的MySQL服务器主机&#39;[us-cdbr-azure-sat-02.cloudapp.net]&#39;(0) - ERROR 2005 (HY000): Unknown MySQL server host '[us-cdbr-azure-sat-02.cloudapp.net]' (0) 好的,Laravel5中的MySql连接错误:“ PDOException” SQLSTATE [HY000] [2005]未知的MySQL服务器主机“ mysql”(2)” - Behat, MySql Connection error in Laravel5 : 'PDOException''SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' Laravel错误中的PHPUnit:消息消息为&#39;SQLSTATE [HY000] [2005]未知的MySQL服务器主机&#39;mysql&#39;(2)&#39; - PHPUnit in Laravel error : Exception' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' mysql.connector.errors.DatabaseError: 2005 (HY000): Unknown MySQL 服务器主机 'db' (2) - mysql.connector.errors.DatabaseError: 2005 (HY000): Unknown MySQL server host 'db' (2)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM