Docker chown cannot dereference var/lib/mysql mysql sock No such file or directory

Docker chown cannot dereference var/lib/mysql mysql sock No such file or directory

https://s24255.pcdn.co/wp-content/uploads/2014/03/Cant-connect-to-local-MySQL-server-through-socket.png

Check domysqld.sock and mysqld.pid exist or not. If not, inside the docker terminal, run these commands :

sudo touch /var/run/mysqld/mysqld.sock
sudo touch /var/run/mysqld/mysqld.pid
sudo chown -R mysql:mysql /var/run/mysqld/mysqld.sock
sudo chown -R mysql:mysql /var/run/mysqld/mysqld.pid
sudo chmod -R 644 /var/run/mysqld/mysqld.sock

Then, restart mysql service :

sudo service mysql restart

Still, if your mysql can’t connect to mysql. Run this method and restart the service of mysql (maybe you also need to restart the container if still can’t connect to mysql) :

sudo chown -R mysql:mysql /var/lib/mysql /var/run/mysqld

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.

Docker chown cannot dereference var/lib/mysql mysql sock No such file or directory

Abdul Manaf

9,34914 gold badges68 silver badges83 bronze badges

asked Jan 20, 2012 at 4:33

2

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

answered Jan 20, 2012 at 5:13

Docker chown cannot dereference var/lib/mysql mysql sock No such file or directory

Abdul ManafAbdul Manaf

9,34914 gold badges68 silver badges83 bronze badges

2

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.

answered Mar 30, 2021 at 8:09

Docker chown cannot dereference var/lib/mysql mysql sock No such file or directory

Just do it, it worked to me...

mysql.server start

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

Docker chown cannot dereference var/lib/mysql mysql sock No such file or directory

answered May 31, 2021 at 11:04

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

I can not start MariaDB because there is no mysqld.sock file in var/run/mysqld/ folder. I have uninstalled and reinstalled.

I have run mysql_install_db, it was apparently successful. When I ran mysqld_safe it had problems. Mysql-secure_installation hangs with an error no such file in mysqld.sock /var/run/mysqld/. Searching for it came up empty, there was no such file anywhere.

I am having trouble with generating a bug report.

My question is how do find, download, or make the missing file. I have searched mysql and googled without any success.

My OS is Ubuntu 11.04

Answer

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!

  • ↑ Starting and Stopping MariaDB ↑

Comments

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.

Starting yesterday, I'm getting this error when connecting to mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I haven't touched my setup for ~1 month so I don't believe its driven by any changes I've attempted to make to the setup. When I try to restart mysql service with

service mysqld restart

I get this error:

Stopping mysqld: [ OK ] touch: cannot touch ‘/var/log/mysqld.log’: Permission denied chown: changing ownership of ‘/var/log/mysqld.log’: Operation not permitted chmod: changing permissions of ‘/var/log/mysqld.log’: Operation not permitted chown: changing ownership of ‘/var/lib/mysql’: Operation not permitted chmod: changing permissions of ‘/var/lib/mysql’: Operation not permitted MySQL Daemon failed to start.

And if I try:

sudo service mysqld restart

I just get:

Stopping mysqld: [ OK ] MySQL Daemon failed to start. Starting mysqld: [FAILED]

I think its a permissions issue based off what I've read on other server fault threads about the same error but I'm still stumped because I should have permissions to execute files in that directory:

drwxr-xr-x 6 mysql mysql 4096 Jun 21 16:42 /var/lib/mysql

Update: logs below. Looks like a memory issue but I don't know how to address:

140618 20:17:46 mysqld_safe Number of processes running now: 0 140618 20:17:46 mysqld_safe mysqld restarted 140618 20:17:47 [Note] Plugin 'FEDERATED' is disabled. 140618 20:17:47 InnoDB: The InnoDB memory heap is disabled 140618 20:17:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins 140618 20:17:47 InnoDB: Compressed tables use zlib 1.2.7 140618 20:17:47 InnoDB: Using Linux native AIO 140618 20:17:47 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 140618 20:17:47 InnoDB: Completed initialization of buffer pool 140618 20:17:47 InnoDB: Fatal error: cannot allocate memory for the buffer pool 140618 20:17:47 [ERROR] Plugin 'InnoDB' init function returned error. 140618 20:17:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 140618 20:17:47 [ERROR] Unknown/unsupported storage engine: InnoDB 140618 20:17:47 [ERROR] Aborting 140618 20:17:47 [Note] /usr/libexec/mysqld: Shutdown complete 140618 20:17:47 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 140621 16:42:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 140621 16:42:49 [Note] Plugin 'FEDERATED' is disabled. 140621 16:42:49 InnoDB: The InnoDB memory heap is disabled 140621 16:42:49 InnoDB: Mutexes and rw_locks use GCC atomic builtins 140621 16:42:49 InnoDB: Compressed tables use zlib 1.2.7 140621 16:42:49 InnoDB: Using Linux native AIO 140621 16:42:50 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 140621 16:42:50 InnoDB: Completed initialization of buffer pool 140621 16:42:50 InnoDB: Fatal error: cannot allocate memory for the buffer pool 140621 16:42:50 [ERROR] Plugin 'InnoDB' init function returned error. 140621 16:42:50 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 140621 16:42:50 [ERROR] Unknown/unsupported storage engine: InnoDB 140621 16:42:50 [ERROR] Aborting 140621 16:42:50 [Note] /usr/libexec/mysqld: Shutdown complete 140621 16:42:50 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

UPDATE: Found the answer here which was setting up a swap file. The full details I followed on how to do this can be found here: http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html