本文介绍了MySQL连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码


$ Host =" localhost";

$ User =" Fred";

$ Database =" house";

$ Password =" mypw"


echo" before mysqli< br /> Host:" ; 。 $ Host。 "< br />" 。 $用户。 "< br />" 。

$数据库;


@ $ db = new mysqli($ Host,$ User,$ Password);


echoConnection is 。 mysqli_connect_errno();


执行第一个echo但第二个不执行。我使用命令行运行了相同的

参数:


mysql -h localhost -u Fred -p


然后


使用房子


我连接到房子数据库。


我在IE 7和Firefox中都尝试了相同的结果。


我是这些东西的新手,所以所有的帮助将不胜感激。


谢谢..

解决方案



I have the following code

$Host = "localhost";
$User = "Fred";
$Database = "house";
$Password = "mypw"

echo "before mysqli<br />Host: " . $Host . "<br />" . $User . "<br />" .
$Database;

@ $db = new mysqli($Host, $User, $Password);

echo "Connection is " . mysqli_connect_errno();

The first echo is executed but the second is not. I have ran the very same
parameters from the command line using:

mysql -h localhost -u Fred -p

Then

use house

and I connect to the house database.

I tried this in both IE 7 and Firefox with the same results.

I''m new to this stuff so all help will be appreciated.

Thanks..


解决方案




这篇关于MySQL连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:03