SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    failed to connect to mysql

    Hello all,

    I am just begining to learn php and mysql. I set up my linux box following the instructions from the tutorial on mysql.com. I get the following error message when I try to connect to mysql through php

    Warning: Mysql connection failed, can;t connect to local mysql server through socket "/tmp/mysql.sock'(111) in /home/httpd/html/test2.php on line 5

    Does anyone know what this means?

    thanks

    Pauli

  2. #2
    SitePoint Zealot New Oddity's Avatar
    Join Date
    Jun 2001
    Location
    Georgia
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add:

    PHP Code:
    echo mysql_error(); 
    after the offending command. It will display a more detailed error message.
    --Odd
    "We all live in a yellow subroutine."
    "Some call it insanity; I call it inspiration!"

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually your error message is quite clear. Its either that mysql is not runnning or mysql cannot find mysql.sock. You can do a

    bash: ps -ax | grep mysql

    to see if mysql is running. You should get something like
    10611 ? S 0:00 /usr/sbin/mysqld
    10731 pts/0 S 0:00 grep mysql

    if its running, if its not you need to start it.

    To start it
    bash: cd/path/to/mysql/bin
    bash: ./mysqld -u root -p


    If it is running then the error usually means that mysql cannot find the mysql.sock file so do thi:

    Make a sym link from whereever mysql.sock lives to /tmp/mysql.sock for instance one time it was located at /var/mysql/mysql.sock

    For instance
    bash: ln -s /var/mysql/mysql.sock /tmp/mysql.sock
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    What's HTML?
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    1,701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got the same problem right now, again. I already checked, and MySQL is running. So I figured it couldn't locate mysql.sock. But here's the kicker, I couldn't find mysql.sock either, I ran a locate but it didn't turn up anything.

    And to top it off, everything was working fine last night. Now I'm getting nothing. Any ideas would be greatly appreciated.
    Ryan Kuhle - A Proud Advisor - Got Questions? Just Ask!
    Get your website started for less than $20! Click Here


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •