docker-compose-lamp icon indicating copy to clipboard operation
docker-compose-lamp copied to clipboard

probleme with mysql

Open SnoxiK opened this issue 2 years ago • 11 comments

Hello, thank you for this docker.

just a small problem I migrated the docker from windows (docker desktop) to synology I had a problem with the ips but that's fixed so my dockers run on different ips except mysql. so I don't know connect to the database can you help me please? instead of having database for the connection I would like to have an ip address.

I am with the basic files. phh-8.1

i have this error on docker mysql:

mysqld failed while attempting to check config

command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.Tcr1VBKHVn

mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 1.

SnoxiK avatar Jul 06 '22 13:07 SnoxiK

Hi @SnoxiK inside the docker-compose.yml there is a section inside the database area at the end where it says 127.0.0.1 .... . You need to change/remove this 127.0.0.1 part, then the container should listen on your bridged network address like the webserver (your NAS adress).

MrOffline77 avatar Jul 06 '22 17:07 MrOffline77

I encountered the same error message. When checking the upstream mysql:8 image I found that there is no file /etc/mysql/my.cnf, and the new file created by https://github.com/sprintcube/docker-compose-lamp/blob/master/bin/mysql8/Dockerfile#L2 is missing the [mysqld] group.

I suspect that the config files in the upstream image were reorganized, leading to this error.

My quick fix was to uncomment the default-authentication-plugin section in /etc/my.cnf. I replace the RUN command with

RUN sed -i 's/^# default-authentication-plugin/default-authentication-plugin/g' /etc/my.cnf

denniskorbginski avatar Jul 07 '22 13:07 denniskorbginski

Can't get docker to go following command because there is version error with synology docker but it seems the right thing for normal dockerdesktop :)

SnoxiK avatar Jul 08 '22 13:07 SnoxiK

My quick fix was to uncomment the default-authentication-plugin section in /etc/my.cnf. I replace the RUN command with

RUN sed -i 's/^# default-authentication-plugin/default-authentication-plugin/g' /etc/my.cnf

Did not work for me.

tertek avatar Jul 13 '22 12:07 tertek

I will check this today and if necessary I will provide a fix asap. Thanks for reporting :)

MrOffline77 avatar Jul 15 '22 13:07 MrOffline77

Please rebuild your stack with docker-compose up -d --build. Should work now. Looks indeed like a change in the upstream image. Let me know if you still encounter any issues with the db container.

MrOffline77 avatar Jul 15 '22 17:07 MrOffline77

Please rebuild your stack with docker-compose up -d --build. Should work now. Looks indeed like a change in the upstream image. Let me know if you still encounter any issues with the db container.

Works like a charm. Tested on 20.04.4 LTS (Focal Fossa) in WSL. thanks!

tertek avatar Jul 18 '22 07:07 tertek

Hi @MrOffline77 I tried this but still I can't access mysql from within the container, I have mysql workbench installed and I can access it from there, also executing migration command in laravel out side of webserver container it does connect to db but inside the container it doesn't work and hence when I access the local website in browser same thing happens.

Please rebuild your stack with docker-compose up -d --build. Should work now. Looks indeed like a change in the upstream image. Let me know if you still encounter any issues with the db container.

azzalluq avatar Jul 21 '22 05:07 azzalluq

I've got the same thing. Don't know what caused it. Moved the docker stack from Ubuntu to Arch Linux though. docker-compose up -d --build did not work for me.

dennis@server2:~/helloworld/website/docker-compose-lamp$ sudo docker-compose up [+] Running 4/4 ⠿ Network helloworld_default Created 0.1s ⠿ Container helloworld-mysql8 Created 0.2s ⠿ Container helloworld-phpmyadmin Created 0.2s ⠿ Container helloworld-php8 Created 0.2s Attaching to helloworld-mysql8, helloworld-php8, helloworld-phpmyadmin helloworld-mysql8 | 2022-07-29 11:51:24+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started. helloworld-mysql8 | 2022-07-29 11:51:24+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config helloworld-mysql8 | command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.FlTHrnOyM6 helloworld-mysql8 | mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 1. helloworld-mysql8 | mysqld: [ERROR] Fatal error in defaults handling. Program aborted! helloworld-mysql8 exited with code 1 helloworld-phpmyadmin | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.4. Set the 'ServerName' directive globally to suppress this message helloworld-phpmyadmin | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.4. Set the 'ServerName' directive globally to suppress this message helloworld-phpmyadmin | [Fri Jul 29 11:51:25.820068 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.53 (Debian) PHP/8.0.19 configured -- resuming normal operations helloworld-phpmyadmin | [Fri Jul 29 11:51:25.820141 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND' helloworld-php8 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.3. Set the 'ServerName' directive globally to suppress this message helloworld-mysql8 | 2022-07-29 11:51:26+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config helloworld-mysql8 | command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.v84hTe8SLz helloworld-mysql8 | mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 1. helloworld-mysql8 | mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

dennisvanderpool avatar Jul 29 '22 11:07 dennisvanderpool

Got my issue fixed via a work-around. My issue was caused because I moved my containers over from an Ubuntu based server to a new Arch based server and thus pulled in the new docker images. The newer version has caused the issue.

Resolved the issue by:

  1. Copying the /etc/mysql/my.cnf from the container to my docker host via docker cp <containername>:/etc/mysql/my.cnf ./config/mysql/my.cnf
  2. Adding an additional bind mount to the docker-compose.yml file for the config file: - ./config/mysql/my.cnf:/etc/mysql/my.cnf
  3. Adding the [mysqld] to the config file, so the file now contains:
[mysqld]
default-authentication-plugin=mysql_native_password

Thanks @denniskorbginski for the hint.

dennisvanderpool avatar Jul 29 '22 19:07 dennisvanderpool

@dennisvanderpool I assume you have git pulled before the rebuild ? You could try to delete you local docker image which is tagged with $COMPOSE_PROJECT-$databaseversion name to force a rebuild.

MrOffline77 avatar Aug 02 '22 16:08 MrOffline77

No update from issue creator - close

MrOffline77 avatar Dec 18 '22 18:12 MrOffline77