Comments - Missing mysqld.sock file?

 
1 month, 1 week ago 18joe48 Klepper

It's a bit late, but maybe the reason is not enough RAM. Add a swapfile. See https://forums.docker.com/t/var-lib-mysql-mysql-sock-is-not-created-sometimes/142851/5

 
12 years, 8 months ago Francois Mayolle

Hello,

I tried to install MariaDB on an Ubuntu 11.10 amd64 OS, following step by step process provided at "Installing MariaDB .deb Files/Installing MariaDB using APT" (installation log available if needed).

Then when trying to run "mysql" an error message said: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)".

"mysqld" command prompted: "120102 11:07:43 [Warning] Can't create test file /var/lib/mysql/francois-sacesosi.lower-test - mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2) - 120102 11:07:43 [ERROR] Aborting - 120102 11:07:43 [Note] mysqld: Shutdown complete"

I tried to changed path to /tmp/mysql.sock within "my.cnf" file, but in fact there is "mysql.sock" or "mysqld.sock" file nowhere!

Also tried to run command "sudo apt-get install socket", but it did not change anything (while socket package was apparently installed).

I would appreciate some hint on the way to fix it (please keep it very simple as I am not an IT expert).

Thanks in advance for your help... and Happy New Year to the AskMonty community!

 
12 years, 8 months ago Daniel Bartholomew

The mysql.sock file is created when MariaDB starts and is removed when MariaDB is shutdown. It won't exist if MariaDB is not running.

I've had issues with finding the socket file once when I accidentally had multiple conflicting my.cnf files. Check to see if you have multiple my.cnf files on your system. Common locations include:

  • /etc/mysql/my.cnf (MariaDB default)
  • /etc/my.cnf
  • ~/.my.cnf
 
12 years, 10 months ago David Myers

Hello all,

I first encountered the same problem when I installed drupal onto a mysql 5.0 instance.

The standard instal (which for me was in fact an install from source) of MySQL places the mysqld.sock file in the tmp directory. It seems that often, other software expects to see it in the /var/run/mysqld folder.

The solution is to either change the setting in the my.cnf file

socket = /tmp/mysql.sock

or to create the required symlink.

ln -s /tmp/mysql.sock /var/run/mysqld/mysql.sock

[you will need to be root, so use sudo on debian based systems]

I use the second solution as it enables you to be place a link to the file wherever a bit of software is expecting it to be.

 
13 years, 1 month ago colin charles

Try doing:

cd /etc/init.d Go to where mysqld is, and try: ./mysqld start

Then do mysql -uroot and see if you can login.

Also, it would help if you tell us how you installed MariaDB. Thanks!

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.