简体   繁体   English

警告:mysqli::__construct(): (HY000/2002): 连接被拒绝

[英]Warning: mysqli::__construct(): (HY000/2002): Connection refused in

I am trying to do some coding and I've taken a free webhost for that.我正在尝试进行一些编码,为此我使用了免费的虚拟主机。

$servername = "127.0.0.1";
$username = "ltm_23041946";
$password = "pass_wass_heree";
$dbname = "ltm_23041946_a";
$conn = new mysqli($servername, $username, $password, $dbname);

Is my code, but I get multiple errors with this.是我的代码,但是我遇到了多个错误。 Here are my errors;这是我的错误;

Warning: mysqli::__construct(): (HY000/2002): Connection refused in >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php on line 12警告: mysqli::__construct(): (HY000/2002): Connection denied in >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php on line 12

Notice: Undefined variable: conn in >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php on line 18注意:未定义变量:conn in >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php on line 18

Fatal error: Uncaught Error: Call to a member function query() on null in >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php:18 Stack >trace: #0 /home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php(51): >insert('a', 'md2') #1 {main} thrown in >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php on line 18致命错误:未捕获的错误:在 >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php:18 中的 null 上调用成员函数 query() 堆栈 >trace: #0 /home/vol14_2/ultimatefreehost.in /ltm_23041946/htdocs/create.php(51): >insert('a', 'md2') #1 {main} 在第 18 行抛出 >/home/vol14_2/ultimatefreehost.in/ltm_23041946/htdocs/create.php

I searched around trying to get answers, but I am still stuck with this.我四处寻找答案,但我仍然坚持这一点。 If anyone could help, I would be thankfull!如果有人可以提供帮助,我将不胜感激!

Even using 127.0.0.1 connection might not work in servers with multiple interfaces or with special routing rules.即使使用127.0.0.1连接也可能不适用于具有多个接口或具有特殊路由规则的服务器。 Run mysqlcheck --help and take the IP address and port shown at the bottom in the "port" and "host" fields.运行mysqlcheck --help并获取显示在“端口”和“主机”字段底部的 IP 地址和端口。 For example:例如:

port                              3306
host                              192.168.1.23

Use the IP and port that MySQL recognizes:使用 MySQL 识别的 IP 和端口:

$servername = "192.168.1.23:3306";

暂无
暂无

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

相关问题 警告:mysqli::__construct(): (HY000/2002): 连接被拒绝 - Warning: mysqli::__construct(): (HY000/2002): Connection refused MySQL 错误 mysqli::__construct(): (HY000/2002): 连接被拒绝 - MySQL Error mysqli::__construct(): (HY000/2002): Connection refused 警告:mysqli_connect():( HY000 / 2002):拒绝连接 - Warning: mysqli_connect(): (HY000/2002): Connection refused in PHP 警告:mysqli_connect(): (HY000/2002): 连接被拒绝 - PHP Warning: mysqli_connect(): (HY000/2002): Connection refused 连接被拒绝“mysqli_connect(): (HY000/2002): Connection denied in ****************************conn.php on line 6 Failed - Connection refused "mysqli_connect(): (HY000/2002): Connection refused in **************************conn.php on line 6 Failed PHP警告:mysqli :: __ construct():(HY000 / 2002):没有这样的文件或目录(Debian GNU / Linux 9) - PHP Warning: mysqli::__construct(): (HY000/2002): No such file or directory (Debian GNU/Linux 9) mysqli_connect():(HY000 / 2002):使用ipv6地址拒绝连接 - mysqli_connect(): (HY000/2002): Connection refused using ipv6 address mysqli_connect(): (HY000/2002): 由于目标机器主动拒绝,无法建立连接 - mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it Mysqli_connect(): (HY000/2002): SYNOLOGY NAS 网站建设中的连接被拒绝 - Mysqli_connect(): (HY000/2002): Connection refused in Website Building ON SYNOLOGY NAS phpMyAdmin mysqli::real_connect(): (HY000/2002): 连接被拒绝 - phpMyAdmin mysqli::real_connect(): (HY000/2002): Connection refused
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM