connecting to mySQL DB

Posted:
in Genius Bar edited January 2014
I am running panther with the newest release of mySQL (version 4.0.18) and php. I am hosting the website for my band on this website and I am trying to connect to the database, but I am having some problems. Here is my php code:



$db = mysql_connect(":/usr/local/mysql/data", "root","myPassword");

mysql_select_db("shows",$db);



I have already created a database called DreyfusAffair (the band name) and a table inside of it called shows. Where do I specify the database at? Any help with why I can't connect to it would be greatly appreciated. Thanks.



Brian

Comments

  • Reply 1 of 1
    the pie manthe pie man Posts: 425member
    The "location" isn't an actual file location - it is a hostname location. So if it is on the same machine, try localhost - or you can use an IP or hostname.



    Assuming your syntax is currently correct (I use PEAR:B to connect to MySQL), then it should be:



    $db = mysql_connect("localhost", "root", "myPassword");

    mysql_select_db("shows", $db);
Sign In or Register to comment.