With the docker composer below I cannot conect to my mysql container from my php
container. I get error:
ERROR 2026 (HY000): TLS/SSL error: self-signed certificate in certificate chain
The mysql container works form my host:
docker exec -it my_project_mysql bash -c "mysql -u root -proot"
But not from the php container
docker exec --privileged -it my_project_php bash
5f47b4b8b4c7:/var/www#
5f47b4b8b4c7:/var/www# mysql -h my_project_mysql
ERROR 2026 (HY000): TLS/SSL error: self-signed certificate in certificate chain
My docker.yml:
services:
####################################################################################################
# PHP
####################################################################################################
php:
container_name: my_project_php
build: .docker/php
ports:
- 5173:5173
volumes:
- .:/var/www:cached
extra_hosts:
- "host.docker.internal:host-gateway"
####################################################################################################
# Nginx
####################################################################################################
nginx:
container_name: my_project_nginx
image: nginx
ports:
- 8000:80
volumes:
- .:/var/www
- .docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
- .docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- .docker/nginx/certs:/etc/nginx/ssl
depends_on:
- php
####################################################################################################
# DATABASE (MySQL)
# docker exec -it my_project_mysql bash -c "mysql -u root -proot"
# for a sql client: mysql -h localhost --protocol=tcp -uroot -proot
####################################################################################################
my_project_db:
container_name: my_project_mysql
image: mysql:8.0
ports:
- 3306:3306
volumes:
- .docker/db/data:/var/lib/mysql
- .docker/logs:/var/log/mysql
- .docker/db/my.cnf:/etc/mysql/conf.d/my.cnf
- .docker/db/sql:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: my_project_db_name
MYSQL_USER: my_project_db_user
MYSQL_PASSWORD: my_project_db_pass
I am not an expert and
I have been trouble shooting in the folder:
.docker/db/data/
My assumption is that the certifactions her are not correct, but I don’t know to go further.