How to get MySql.sock file, if missing from tmp folder ?

How to get MySql.sock file, if missing from tmp folder ?

If you are getting the error “MySQL Connection Failed Can't connects to local MySQL server through socket '/tmp/mysql.sock'” then it means MySql.sock file is missing from your files. Sometimes MySql.sock file is deleted by user but after that we are not able to access the php pages. MySql.sock file is mostly available in folder “/mysql/tmp/”. If you mistakenly deleted the MySql.sock file then this tutorial is very helpful for you.

1. Before making any changes first you have to take backup of /var/lib/mysql directory with this command :

Code:
# cp -fr /var/lib/mysql /var/lib/mysql.old
2. Now you have to check for the MySql.sock file in both places :

Code:
/var/lib/mysql and /tmp
3. If you found the file in these folders then you have to recreate the symbolic link with this command

Code:
# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
4. Now its time to check permission of file, MySql.sock file permission should be 0755 and msql : root. If permission is wrong then enter the following command to assign the permission and user :

Code:
# chmod 0755 /var/lib/mysql
# chown mysql:root /var/lib/mysql
5. To check the MySql user you n=have to enter this :

Code:
cat /etc/passwd
6. Now check for “host.MYI” file in path host.MYI and if the file is not available then enter the following command :

Code:
# chmod -R 0660 /var/lib/mysql/mysql
# chown -R mysql:mysql /var/lib/mysql/mysql
# /usr/bin/mysql_install_db
7. Now for Linux server you have to run this command for force updation

Code:
# /scripts/mysqlup –force
8. After update again check the mysql directory that we have backed up :

Code:
# rm -fr /var/lib/mysql
# rm -f /usr/sbin/mysqld
9. Then again run force command to update :

Code:
# /scripts/mysqlup –force
These all steps will definitely help you to overcome from this problem.
Author
bhawanisingh
Views
8,561
First release
Last update
Rating
0.00 star(s) 0 ratings
Top