开发者

mySQL connection issue when migrating from webserver to MAMP

OK so I've recently moved to MAMP for a project using PHP and mySQL. I开发者_运维百科've set up the database and copied all the data but now the script doesn't work. I haven't changed the default username or password. Any ideas? Here's the code I'm using, it fails at connecting to the database.

<?php
$dbhost = "localhost";
$dbname = "test";
$dbuser = "root";
$dbpass = "root";

mysql_connect("$dbhost", "$dbuser", "$dbpass") or die (mysql_error());
mysql_select_db("$dbname") or die(mysql_error());
?>


Check what value php.ini has for the default mysql socket - MAMP creates one in /Applications/MAMP/tmp/mysql whereas the mysql default location is /tmp

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜