through - where is mysql.sock ubuntu




Missing/var/lib/mysql/mysql.sock file (4)

I'm trying to access mysql and when I run the mysql command, I get the following.

[[email protected] tpdatabase-1.8.0.28356]# mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Doing this returns nothing

[[email protected] mysqld]# find -name mysql*

[[email protected] mysqld]# /etc/init.d/mysql stop -bash: /etc/init.d/mysql: No such file or directory

[[email protected] tpdatabase-1.8.0.28356]# mysql_config |grep -- --socket

--socket [/var/lib/mysql/mysql.sock]

Maybe a permissions problem?

I do have mysql installed using yum install mysql

I'm running CentOS 5.4 on a Amazon EC2 Cloud Instance


Before hitting mysql on command prompt make sure your correct my.cnf configuration file is in placed and set the permission of etc folder as

chmod -R 777

etc folder as below list to avoid

error MySQL - ERROR 2002 (HY000): e.g /etc/my.cnf, /etc/mysql/my.cnf, $MYSQL_HOME/my.cnf [datadir]/my.cnf ~/.my.cnf


We faced a similar problem in my office setup with the same OS. The actual thing that was happening was low space on the server. It is quite strange, but i believe if the server gets full the files cannot be loaded or of some other resort. Please check to be sure the space on the server is enough else you have to try removing the installed mysql and reinstall. Best of luck.


just search for mysqld, this is the server daemon:

find / | grep mysqld

If you found it, the server package may be correctly installed but without initd scripts. For testing, you may start the mysql server by hand executing the above file.


mysql might have been packaged separately as client and server. Check your package repositories to make sure that the server has been installed. The mysql package might only be the client. Check if there's a package called mysql-server or something similar. Check the list of files installed by the mysql package to see if it actually installs the server.

If the files are not even there, it's not a permissions problem. Also, you're running as root.







amazon-ec2