godaddy mysql syntax

Discussion in 'MySQL' started by sharpshooter, Mar 26, 2008.

  1. #1
    Hi, newbie question, I am trying to connect to a godaddy mysql with a third party script as follows

     function Db($db_host="mysqlname", $db_user="User", $db_password = "Password", $db_name = "Name", $db_pconnect = 0) {
        $connect_handle = ($db_pconnect) ? "mysql_pconnect" : "mysql_connect";
        if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {
          $this->error("Could not connect to the database server ($db_host, $db_user).", 1);
        }
    PHP:
    But it is giving me the knockback with error

    Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/s/h/a/name/html/includes/db_mysql.php on line 39
    PHP:
    An unexpected error occured. Please try again later.

    Can anyone help?
     
    sharpshooter, Mar 26, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    What is the mysqlname set to? Godaddy is the exception to use "localhost". You have to go into their control panel under databases >mysql>Click the edit button. The hostname will be listed 2nd:

    Host Name: p14mysql532.secureserver.net

    And you have to check it per database, even if they are the same acct, godaddy will put them on different mysql servers.
     
    shallowink, Mar 26, 2008 IP
  3. sharpshooter

    sharpshooter Well-Known Member

    Messages:
    161
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #3
    the name is the same as you listed - I knew to remove localhost. I just replaced it with name cos I didn't know if it was account specific or generic
     
    sharpshooter, Mar 26, 2008 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    Most webhosts you just use localhost and it works. Godaddy's just a pain about it. Getting the hostname from the ctrl panel should fix your problem though.
     
    shallowink, Mar 26, 2008 IP
  5. sharpshooter

    sharpshooter Well-Known Member

    Messages:
    161
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #5
    I have logged a ticket - presumably, they will just send a link to the godaddy mysql help page (which I have looked at)
     
    sharpshooter, Mar 26, 2008 IP
  6. sharpshooter

    sharpshooter Well-Known Member

    Messages:
    161
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #6
    No joy from the ticket - before I post a job on the job board - does anyone want to bid for fixing it (paid)
     
    sharpshooter, Mar 27, 2008 IP