每当我尝试连接到我的localhost(使用MAMP)时,它会告诉我访问被拒绝或无法连接!这让我抓狂!我有下面的php示例。我错过了什么,因为网上显然没有人遇到同样的问题......
//setup db connection
$link = mysqli_connect("localhost","root","");
mysqli_select_db($link, "iReport")
答案 0 :(得分:-1)
尝试......
//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());