每次我尝试连接到我的本地主机(使用 MAMP)时,它都会告诉我访问被拒绝或无法连接!!!它快把我逼疯了!我有下面的 php 示例。我错过了什么,因为显然网络上没有人遇到同样的问题......
//setup db connection
$link = mysqli_connect("localhost","root","");
mysqli_select_db($link, "iReport")
尝试...
//Database Information
$dbhost = "serverip";
$dbname = "databasename";
$dbuser = "username";
$dbpass = "password";
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());