mysql not working on my mac

Discussion in 'Web Design and Development' started by running, Sep 15, 2007.

  1. running macrumors member

    Joined:
    Jan 11, 2006
    #1
    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?
     
  2. running thread starter macrumors member

    Joined:
    Jan 11, 2006
    #3
    thanks

    thanks nightelf!! (I still wonder why stuff like that dont work "out of the box")
     

Share This Page