Skip to main content

Can't connect to local MySQL server through socket

Comments

7 comments

  • Infopro
    Your forums Access level is Website Owner, do you have root access to the server you're on? If not, you might want to speak with your Hosting Provider about this.
    0
  • Cleyton Silva
    Your forums Access level is Website Owner, do you have root access to the server you're on? If not, you might want to speak with your Hosting Provider about this.

    Hello, thanks! I have access to root yes.
    0
  • Jcats
    Can you confirm MySQL is online? In SSH simply type:
    # mysql
    Does it bring up mysql prompt:
    mysql>
    or throw an error? Also what does this give you:
    # ll /var/lib/mysql/mysql.sock
    0
  • Cleyton Silva
    Can you confirm MySQL is online? In SSH simply type:
    # mysql
    Does it bring up mysql prompt:
    mysql>
    or throw an error? Also what does this give you:
    # ll /var/lib/mysql/mysql.sock

    I did the procedure and no error appeared.
    0
  • cPanelMichael
    Hello, Check to see if a .my.cnf file exists under the account's home directory (/home/$username/). If so, verify it uses the correct credentials, or try updating the individual account's MySQL password after consulting with the user via: "WHM Home " SQL Services " Change MySQL User Password" Thank you.
    0
  • vacancy
    mysql log did you check? tail -f /var/lib/mysql/hostname.err
    0
  • germany
    I think you didn't started your database server, start it using #services mysql start or #/etc/init.d/mysql start If you are getting a failure message while starting, check the log file (/var/log/syslog), if you found socket connection error message there, then check for correct socket file location #find / -type s, if you found a mysqld.sock file under /var/run/mysqld/ directory, check whether any instances of mysqld running or not #netstat -anpt | grep 3306 or #ps aux | grep mysqld if you found any running process stop it (#kill -9 pid) and remove the socket file. Then try to restart it and if mysql not creating socket file then try start it like #/usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr --datadir=/var/lib/mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock Also check your my.cnf file (/etc/mysql/my.cnf) and comment the bind-address field, and if you found any skip-network field comment it.
    0

Please sign in to leave a comment.