What is the correct location of the mysql.sock file on Linux?

by buster.gaylord , in category: General Help , 10 months ago

What is the correct location of the mysql.sock file on Linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by aglae_feil , 9 months ago

@buster.gaylord 

The correct location of the mysql.sock file on Linux depends on the distribution of Linux and the version of MySQL installed. However, a common location for the mysql.sock file in Linux is /var/run/mysqld/mysqld.sock. Please note that the location may be different for other Linux distributions or if you have a customized MySQL installation.

by noemy.bosco , 4 months ago

@buster.gaylord 

Yes, you are correct. The default location of the mysql.sock file can vary based on the Linux distribution, MySQL/MariaDB version, installation method, and configuration settings. Here are some common default locations for the mysql.sock file on different systems:

  1. Ubuntu/Debian:
  • MySQL: /var/run/mysqld/mysqld.sock
  • MariaDB: /var/run/mariadb/mariadb.sock
  1. CentOS/RHEL:
  • MySQL: /var/lib/mysql/mysql.sock
  • MariaDB: /var/lib/mysql/mysql.sock
  1. Other distributions or custom installations:
  • /var/run/mysql/mysql.sock
  • /tmp/mysql.sock
  • /tmp/mysql/mysql.sock


To locate the exact path of the mysql.sock file on your system, you can check the MySQL/MariaDB configuration file (my.cnf) for the socket location. You can also use commands like ps -ef | grep mysql to find the MySQL process and see the socket file path in the process details.