4

I tried restarting the Mysql server but its not working for me. I am sure the server is running and the permissions on the folder /var/lib/mysql/ are correct (777).

When i tried to open the file mysql.sock, its giving me an error saying the file may be corrupt.

Please help me to log on to the mysql server.

2
  • Question : Is mysqld still running but you cannot connect? Commented Jan 20, 2012 at 17:57
  • Please run service mysql status and post the output of that command Commented Jan 20, 2012 at 18:05

5 Answers 5

4

First: Make sure that the owner of /var/lib/mysql and its files and subdirectories is mysql user of mysql group

to do that run the following command:

chown mysql:mysql -R /var/lib/mysql/*

Second: change write permissions to rwxr-xr-x (755) for mysql directory, and all its files and subdirectories, by running the following command:

chmod 755 -R /var/lib/mysql/*

now start mysql service

service mysql start
2
  • Did everything you suggested, but could not find the mysql.sock file in the folder you specified
    – vinny
    Commented Jan 20, 2012 at 5:53
  • Please tell the location of socket file by seeing from my.cnf. Commented Jan 20, 2012 at 6:14
0

i had same problem and solved with:

mysql_install_db --user=mysql

reference: https://mariadb.com/kb/en/installing-system-tables-mysql_install_db/

0

For me, stopping docker in the background was the solution. Nothing else worked, and nothing pointer to docker except when running

lsof -i TCP:3306

and then trying to

kill <process_id> 

the error from docker popped up so I knew Docker was having some background mysql listeners.

0

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

RAM problem permanently solved by adding a swapfile. It remains strange that

  • the creation of the socket should have been prevented by the lack of memory and

  • that the error also occurs when setting up a swap file, but has no effect in this case.

1
  • Link only answers are usually removed. Please edit it and provide more information. Commented Aug 1 at 22:20
-2

Just do it, it worked to me...

mysql.server start

[mysql -u "username" -p "password"]

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.