Jump to content

cant connect to local Mysql


thehigherentity

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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.