Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
t-franz opened this issue Nov 1, 2022 · 8 comments
Assignees

Comments

@t-franz
Copy link

t-franz commented Nov 1, 2022

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!

@MrOffline77
Copy link
Collaborator

I'm not able to reproduce this on macos.
Is some of our mac users able to double check pls ?

@wschern
Copy link

wschern commented Dec 30, 2022

@t-franz
The following worked for me.
Add to docker-compose.yml at database:

user: mysql

@t-franz
Copy link
Author

t-franz commented Dec 31, 2022

Thank you for your help. I changed the lines to:

  database:
    user: mysql
    [...]

But i still can't connect to the database.
(In the meantime i changed to another environment and that is working.)

@ctechdev
Copy link

ctechdev commented Apr 5, 2023

@t-franz I have the same problem, did you solve it?

@t-franz
Copy link
Author

t-franz commented Apr 16, 2023

@ctechdev No, i'm sorry. I switched to ddev and don't use lamp any more.

@ctechdev
Copy link

ctechdev commented Apr 19, 2023

I'm not able to reproduce this on macos. Is some of our mac users able to double check pls ?

to reproduce the error just change PHPVERSION=php74
DATABASE=mysql57 in the env file, with an installation with default values the error is not generated, I'm trying to build the development environment with these variables and there is no way to make it work

@H3avy6unner
Copy link

I could start the stack with php74 and mysql57 without any issues. BUT if you change the settings and rebuild the images you have to delete the old data in the./data/mysqldirectory wich is mounted into the container by bind mounting. (Of course you could mount another directory too if you want to keep that files). If you don't delete that files, the new database container will get issues with that because the databases are not compatible over the diffrent versions.

@artemsites
Copy link

I could start the stack with php74 and mysql57 without any issues. BUT if you change the settings and rebuild the images you have to delete the old data in the./data/mysqldirectory wich is mounted into the container by bind mounting. (Of course you could mount another directory too if you want to keep that files). If you don't delete that files, the new database container will get issues with that because the databases are not compatible over the diffrent versions.

thanks a lot,
I had problems with phpmyadmin because I was really changing the version of mysql and php,
after deleting the data/mysql folder, the build started working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants