Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

running

macrumors member
Original poster
Jan 11, 2006
58
0
I am just a php and mysql beginner and I want to learn both, so I turned Apache and MySQL on with help of this article, and i created some databases and tables using CocoaMySQL (with username "root" and empty password). But when I write this basic script

Code:
<?php
$link=mysql_connect ("localhost", "root", "") or die ("bad");
echo("good");
mysql_close ($link);
?>
to Library/WebServer/Documents/index.php and I go to localhost with Safari, I get this message:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in /Library/WebServer/Documents/index.php on line 2

What am I doing wrong?
 
thanks

thanks nightelf!! (I still wonder why stuff like that dont work "out of the box")
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.