devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
859 stars 226 forks source link

Could not connect to mariaDB with imageVariant default #233

Closed espdesign closed 5 months ago

espdesign commented 5 months ago

I am very new to this but I wanted to share an issue that took me a while to diagnose and understand I wanted to share in case it needs to be clarified for other new people.

I attempted to use the template php-mariadb and selected the default image variant. everything seemed fine with no errors made evident.

I used the command to try to connect to mariadb. mariadb -h localhost -P 3306 -u root -p

I could not connect to the mariadb it kept throwing me the error. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

I kept reading the readme at https://github.com/devcontainers/templates/tree/main/src/php-mariadb And could not find a solution to my issue.

Turns out the image variant defaults to bullseye. and this was the problem. as soon as i switched to bookworm I could now connect no problem.

samruddhikhandale commented 5 months ago

Hi 👋

Thanks for flagging this issue and adding a solution.

When bookworm was newly supported, I remember php-mariadb failing with mySQL errors as it didn't immediately support it. Hence, we kept the default as bullseye.

Looks like we can update the default now, thanks! Will shortly create a PR.