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 :

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

/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

# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
4. Now its time to check the permission of the 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 :

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

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 :

# 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

# /scripts/mysqlup --force
8. After update again check the MySQL directory that we have backed up :

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

# /scripts/mysqlup --force

These all steps will definitely help you to overcome this problem.

 

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Managed cPanel VPS

cPanel included; we handle updates, security and monitoring.

Server management

on-demand administration, hardening, migrations and monitoring.

Was this answer helpful?

Still stuck? Open a ticket