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 :
2. Now you have to check for the MySql.sock file in both places :
3. If you found the file in these folders then you have to recreate the symbolic link with this command
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 :
5. To check the MySql user you n=have to enter this :
6. Now check for “host.MYI” file in path host.MYI and if the file is not available then enter the following command :
7. Now for Linux server you have to run this command for force updation
8. After update again check the mysql directory that we have backed up :
9. Then again run force command to update :
These all steps will definitely help you to overcome from this problem.
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
Code:
/var/lib/mysql and /tmp
Code:
# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
Code:
# chmod 0755 /var/lib/mysql
# chown mysql:root /var/lib/mysql
Code:
cat /etc/passwd
Code:
# chmod -R 0660 /var/lib/mysql/mysql
# chown -R mysql:mysql /var/lib/mysql/mysql
# /usr/bin/mysql_install_db
Code:
# /scripts/mysqlup –force
Code:
# rm -fr /var/lib/mysql
# rm -f /usr/sbin/mysqld
Code:
# /scripts/mysqlup –force