Jump to content

Archived

This topic is now archived and is closed to further replies.

thehigherentity

cant connect to local Mysql

Recommended Posts

for starters i have only been playing around with mysql for a few days so i know very little about it

I am trying to move a guest book to another server, however I cant connect to mysql and create the needed database

the code we are using is
[code]
$host = 'localhost';
$user = 'username';
$pass = 'password';
$dbname = 'gbook';
$query = "CREATE DATABASE $dbname";
mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_query($query) or die(mysql_error());
[/code]
all we get is the following error!
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

im geussing its the 'localhost' thats the problem, but the server we're trying to move to, is a shared host and gives you access to nothing. I have been told you can access mysql by changing localhost to the correct path but all the information we know is The MySQL installation directory ' /usr/local/mysql' and have no idea how to work out what the correct path is [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

could anyone help me out here? I have been looking round the net and there are loads of sites explaining how to sort this at the prompt, however we dont have access to one!

Share this post


Link to post
Share on other sites
I just went to yahoo search and found this:
[a href=\"http://www.codecomments.com/PHP_SQL/message323526.html\" target=\"_blank\"]http://www.codecomments.com/PHP_SQL/message323526.html[/a]
Hope this helps.

Share this post


Link to post
Share on other sites
I have already read that site and a number of others, however I still cant find a solution, I guess I just wont bother and change it to a flat file system its easier.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.