Results 1 to 8 of 8

Thread: /tmp/mysql.sock not found

  1. #1
    Join Date
    Jul 2013
    Posts
    22

    /tmp/mysql.sock not found

    Hello all,
    After my last problem is solved, I'm facing anew one related to the last. While trying to create a db in user level, I get
    Code:
    Error connecting to MySQL: Can't connect to local MySQL server through socket '/tmp/mysqld.sock' (2)
    But it does exist in tmp! And phpmyadmin works fine and so does the forum hosted on the server. I also found that there was no my.cnf in /etc/ so I added one myself. And I'm scared of restarting mysql if it would start fine or not. How do I solve this error?
    Regards
    Vijai

  2. #2
    Join Date
    Jul 2006
    Location
    isreal
    Posts
    472
    why you change the /etc/my.cnf ?
    by default it's on /var/lib/mysql

    please provide me the
    /etc/my.cnf file


    thanks

  3. #3
    Join Date
    Jul 2013
    Posts
    22
    I had my.cnf in /etc/mysql symlinked /etc/my.cnf. So I created a new my.cnf in /etc/ The contents are:
    Code:
    [mysqld]
    local-infile=0
    socket=/tmp/mysql.sock
    
    [client]
    socket=/tmp/mysql.sock
    And today I restarted mysqld and it said there is already a mysqld_safe process running.
    How do I solve?
    Edit: found that the socket name is actually mysql.sock in /tmp but DA always looks for mysqld.sock . Where and how do I change the name?

    Edit2: Just changed the socket to /tmp/mysqld.sock and the problem in DA is over. It detects mysqld.sock but my forum no more works and it says "unexpected database error occured" And also my other php scripts that connect to mysql localhost!

    Thank you
    Last edited by vijai; 01-05-2014 at 07:40 PM.

  4. #4
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,478
    Hello,

    why you change the /etc/my.cnf ?
    by default it's on /var/lib/mysql
    Debian and CentOS are different in their way to place mysql.sock. And on Debian the socket file is located exactly in /tmp/ by default: /tmp/mysql.sock

    It detects mysqld.sock but my forum no more works and it says "unexpected database error occured" And also my other php scripts that connect to mysql localhost!
    Please make check php.ini and see what values you have there for the followings:

    Code:
    pdo_mysql.default_socket=
    
    mysql.default_socket =
    
    mysqli.default_socket =
    and restart apache. If they are not empty (that's OK if they are), make sure they point to the correct place.

    And try to access MySQL tables via phpMyAdmin and fix/check them all.
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  5. #5
    Join Date
    Jul 2013
    Posts
    22
    Thank you for your help. The values for the above are empty. I feel that the DA actually looks for the wrong socket? mysqld.sock instead of mysql.sock? Because I can find mysql.sock in /tmp/ and when I change it to mysqld.sock in my.cnf, everything breaks but DA works fine. And inverse in the other situation.

  6. #6
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,478
    Please check this: http://www.directadmin.com/features.php?id=477 and http://www.directadmin.com/features.php?id=140

    You might want to try to specify a path to MySQL socket in the file /usr/local/directadmin/conf/mysql.conf and restart directadmin.

    Code:
    socket=/tmp/mysql.sock
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  7. #7
    Join Date
    Jul 2013
    Posts
    22
    Thank you! That solved my problem!

  8. #8
    Join Date
    Sep 2013
    Posts
    13
    ok what if you don't want to use the /tmp/mysql.sock location I have changed the my.conf php.ini and /usr/local/directadmin/conf/mysql.conf but it still will not work in directadmin I can use MYSQL if I use phpmyadmin or anything BUT directadmin but that doesn't help lol

Posting Permissions

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