Skip to content

mysql is always restarting. "Changing ownership of '/var/lib/mysql/mysql.sock': No such file or directory" #221

Open
@t-franz

Description

@t-franz

Describe the bug
The container status for mysql8 is "Restarting ...". I can't connect to MySQL

which Branch / PHP Version are you using ?
docker-compose.yml: Version 3
php8
mysql8

Steps to reproduce
Followed the instructions and it works in the first run:

git clone https://github.com/sprintcube/docker-compose-lamp.git
cd docker-compose-lamp
cp sample.env .env
docker-compose up -d

I can access http://localhost and phpMyAdmin at http://localhost:8080/
Then i stopped and started the containers:

docker compose stop
docker compose start

... and mysql stopped working: mysql is cycling and tries to restart.
desktop

I can access http://localhost, but it shows errors:
error

The log file for the mysql8-Container:

2022-11-01 12:34:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
[Multiple Times]
chown: changing ownership of '/var/lib/mysql/mysql.sock': No such file or directory
[Multiple Times]

Then i removed the content of the data-folder:
rm -rf data/*
And started it again:
docker compose start

And it works again!
How can i solve this, without loosing everything inside the data-folder?

Expected behavior
After stopping and starting the containers, everything should work the same.

Desktop (please complete the following information):
MacOS: 11.7
Docker Desktop: 4.13.0
Docker Compose: 1.29.2

docker -v
Docker version 20.10.20, build 9fdeb9c

Additional context
This seems to be a quite similar problem to #91 – but it didn't help me. (Please ignore my last comment inside that closed issue.)
I'm sorry: It's my first time with Docker. I used MAMP until now and i wanted to switch to Docker ... :-(
Thank you for your help!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions