mysql连接错误码_Mysql连接错误

function getMysqlConnection($host,$user,$pass,$database){

global $mysqli;

global $Mysqlerror;

$mysqli = new mysqli('$host','$user','$pass','$database');

if(empty($mysqli->connect_errorno) == false){

$Mysqlerror = "true";

}else{

$Mysqlerror = "false";

} }

?>我已经创建了一个如上所述的函数,它在给定的mysql用户凭证上实现连接

我通过使用实现了这个功能

require 'myFunc.php';

getMysqlConnection("localhost", "wronguser","wrongpass" ," test");

echo $Mysqlerror;

?>虽然我使用了错误的密码和用户名,但Mysqlerror是错误的。我也使用或死亡功能没有发生

Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/mysite/myFunc.php on line 5

Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in /opt/lampp/htdocs/mysite/myFunc.php on line 5像往常一样,我重新启动了lampp

Starting XAMPP for Linux 1.8.0...

XAMPP: Starting Apache with SSL (and PHP5)...

XAMPP: Starting MySQL...

Warning: World-writable config file '/opt/lampp/etc/my.cnf' is ignored

XAMPP: Starting ProFTPD...

/opt/lampp/share/lampp/alladdons: line 23: /opt/lampp/share/addons/: is a directory

XAMPP for Linux started.是我的代码或与我的服务器有关的问题。如何解决它?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值