SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    Can anyone help with this MySQL error?

    [pc-80-192-42-134-st:~] grant% mysql -u root -p
    Enter password:
    ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    I'm working on a Mac running Mac Os X.2.6

    Thanks in advance

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Type this on a terminal line to see if there is mysql.sock in /tmp (there probably won't be):
    Code:
    ls /tmp
    Then make sure mysql is running:
    Code:
    ps -aux | grep "[m]ysqld"
    If you get a response, a line with some information then mysql is probably running. If you get nothing, it isn't.

    Check those things out and we'll go from there. :-)
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  3. #3
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey samsm

    this is what i got when i did what you asked

    Last login: Wed Jul 9 07:17:51 on console
    Welcome to Darwin!
    [pc-80-192-42-134-st:~] grant% ls /tmp
    501 mysql.sock slp_ipc
    [pc-80-192-42-134-st:~] grant% ps -aux | grep "[m]ysqld"
    [pc-80-192-42-134-st:~] grant%

    thanks for your help

  4. #4
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like mysqld (the mysql daemon) isn't running. It needs to be. :-)

    How did you install mysql?

    See if this starts mysqld:
    /usr/local/mysql/bin/mysqld
    or
    /whateverThePathToMySQLIs/bin/mysqld
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  5. #5
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey samsm

    I installed it as instructed by sitepoint "Build your own database driven website"

    This is what happened when I typed what you said

    [pc-80-192-42-134-st:~] grant% /usr/local/mysql/bin/mysqld
    /usr/local/mysql/bin/mysqld: Can't change dir to '/usr/local/mysql/var/' (Errcode: 2)
    030709 21:53:28 Aborting

    030709 21:53:28 /usr/local/mysql/bin/mysqld: Shutdown Complete

    So I know were not married! However I'm going away for a few days, and might not be able to respond to your replies. I didn't want you to think I was ignoring you after your have been so helpful!

    P.s. isn't the time difference such a pain!

  6. #6
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, the way I have MySQL set up, there is no /mysql/var directory.

    I don't have the instructions in the Sitepoint book, though I imagine that they are based upon Apple's instructions.

    Did you use a pkg installer from here? http://www.mysql.com/downloads/mysql-4.0.html
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  7. #7
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi back again

    yes I did download it from there as instructed by the sitepoint book

  8. #8
    SitePoint Member
    Join Date
    Jun 2003
    Location
    KUL, Malaysia
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by grant.smith
    Hi back again

    yes I did download it from there as instructed by the sitepoint book
    I think it may have something to do with MySQL running as 'root'; it should be user mysql not 'root', refer to this link: http://www.mysql.com/doc/en/Security.html
    Last edited by JdS; Jul 15, 2003 at 09:17.

  9. #9
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:
    sudo /usr/local/mysql/bin/safe_mysqld
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  10. #10
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I did that, and got this

    Last login: Wed Jul 16 16:20:35 on console
    Welcome to Darwin!
    [pc-80-192-42-134-st:~] grant% sudo /usr/local/mysql/bin/safe_mysqld
    Password:
    The file /usr/local/mysql/libexec/mysqld doesn't exist or is not executable
    Please do a cd to the mysql installation directory and restart
    this script from there as follows:
    ./bin/mysqld_safe.

  11. #11
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you understand MySQL's suggestion in that last quote? I'd give that a shot.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  12. #12
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey samsm

    Unfortunately I don’t really fully understand it?

  13. #13
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you understand how to navigate around in the terminal using cd? Basically you type "cd" followed by the name of the directory you want to go to, press enter, and it is done.

    Do you understand that if you install mysql there will be a directory that is referred to as the "mysql" directory, where the files associated with mysql will live? (It is probably located at /usr/local/mysql/ in your case)

    With those two things in mind, let's look at the message:
    The file /usr/local/mysql/libexec/mysqld doesn't exist or is not executable
    This boils down to "error". Don't worry about figuring out exactly what it mean, just read it, and see if it presents an obvious solution like "This must be logged in as root" or something.
    Please do a cd to the mysql installation directory and restart this script from there as follows:
    This is the hard part. :-) Basically use what I mentioned above: cd followed by the directory name:
    cd /usr/local/mysql/
    ./bin/mysqld_safe
    Next, type this command as mysql suggests. You might try running it as root by changing it to:
    sudo ./bin/mysqld_safe
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  14. #14
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey samsm, I do understand what your telling
    me. I did what you suggested and got this

    Last login: Thu Jul 17 17:58:50 on console
    Welcome to Darwin!
    [pc-80-192-42-134-st:~] grant% cd /usr/local/mysql/
    [pc-80-192-42-134-st:/usr/local/mysql] grant% ./bin/mysqld_safe
    chown: /usr/local/mysql/data/pc-80-192-42-134-st.blueyonder.co.uk.err: Operation not permitted
    rm: /usr/local/mysql/data/pc-80-192-42-134-st.blueyonder.co.uk.pid: Permission denied
    Fatal error: Can't remove the pid file: /usr/local/mysql/data/pc-80-192-42-134-st.blueyonder.co.uk.pid
    Please remove it manually and start ./bin/mysqld_safe again
    mysqld daemon not started
    [pc-80-192-42-134-st:/usr/local/mysql] grant% sudo ./bin/mysqld_safe
    Password:
    A mysqld process already exists
    [pc-80-192-42-134-st:/usr/local/mysql] grant%

  15. #15
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by grant.smith
    A mysqld process already exists
    Hmm, try this again:
    Code:
    ps -aux | grep "[m]ysqld"
    . Perhaps you restarted or something since your last test and mysqld loaded properly.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  16. #16
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK? I did that, but what next ?

    This is what I got

    Last login: Fri Jul 18 15:15:15 on console
    Welcome to Darwin!
    [pc-80-192-42-134-st:~] grant% ps -aux | grep "[m]ysqld"
    [pc-80-192-42-134-st:~] grant%

  17. #17
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Crap, I was hoping to see something like this:
    Code:
    samsm% ps -aux | grep "[m]ysql"
    root       377   0.0  0.1     1828    580  ??  S     3:38PM   0:00.06 sh ./bin/safe_mysqld
    mysql      415   0.0  0.2    12204    936  ??  S     3:38PM   0:00.07 /usr/local/mysql-3.2
    samsm%
    Man, if " A mysqld process already exists" then you should be able to log in using mysql -u root -p

    But then again, I would have expected the process list to have produced an entry for mysqld.

    Have you tried just mysql? Perhaps mysqladmin is needed? Have you retraced your steps while rereading the installation documentation? Look at MySQL's instructions, not Sitepoint's. MySQL's will probably be more up to date.

    Yes, I don't know what the problem is, and I'm running low on ideas. :-)
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  18. #18
    SitePoint Enthusiast grant.smith's Avatar
    Join Date
    Jul 2003
    Location
    Britain
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey, thanks for all your help

    This is defiantly a weird one because according to my research all the files are in the right place, I can log in, but I can't perform any actions?

    I have it pre-installed on my web server, I will just have to learn what I need to know on that. It just would be good for testing purposes.

    PHP is all working well its just that socket problem. This is the second time I tried to install it so I think I should leave it as an experience!

    Thanks Again

  19. #19
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by grant.smith
    ... I can log in, but I can't perform any actions?
    When you say this,. do you mean just through php, or can you log in through the command line now?
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?


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
  •