Search code examples
mysqlsocketslinux-mint

error 2002 (HY000): Cant connect to local MySQL server through '/var/run/mysqld/mysqld.sock' (2)


I am trying to use MySQL on a 32-bit Linux Mint machine. There are multiple questions regarding this issue, but i couldn't find a solution anywhere in-spite of trying multiple solutions. I even re-installed MySQL, but still gives me error.

Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38) suggests to change permissions of the folder, but that didn't help. I tried restarting MySQL, but the error still persists.

error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' suggests to find sockets using sudo find / -type s and expects to find socket=/var/lib/mysql/mysql.sock and add this to my.cnf file. But i couldn't find the socket after executing the find command.

In my my.cnf file, 'socket=/var/run/mysqld/mysqld.sock'. But i couldn't find the file mysqld.sock in either /var/run/mysqld or /var/lib/mysql.

How do i get MySQL working ??

Edit:- I executed ps -el | grep mysqld to check if the server is running and i can see the one mysqld process running.


Solution

  • Well this was silly, but frustrating though!!

    The problem actually lie in misspelling INNODB the my.cnf file. The document i was referring to, misspelled the database name as INNOD instead of INNODB in the diagram.

    enter image description here

    Changing this in the my.cnf sorted out the issue.

    I admit my mistake of blindly typing and not verifying. Thank you https://stackoverflow.com/users/5875887/dylan-sufor pointing in right direction.