Skip to content

Testcontainers root user stoped working with latest mysql container #3893

Description

@george-toader-iq

Hello,

A couple of days ago the mysql container got updated and after that our builds started failing because the container would not start.
We use this connection string:
spring.datasource.url=jdbc:tc:mysql:8:///mysql?user=root?password=?TC_INITSCRIPT=schema.sql

We need to use the root user to be able to set some global flags

The container logs show:


2021-03-18 21:04:49+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

2021-03-18 21:04:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.

2021-03-18 21:04:49+00:00 [ERROR] [Entrypoint]: MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user

Use one of the following to control the root user password:

- MYSQL_ROOT_PASSWORD

- MYSQL_ALLOW_EMPTY_PASSWORD

- MYSQL_RANDOM_ROOT_PASSWORD

We tried setting a password for root but that didn't work for us either.

Our quick workaround was to downgrade to 8.0.22, so we now have:
spring.datasource.url=jdbc:tc:mysql:8.0.22:///mysql?user=root?password=?TC_INITSCRIPT=schema.sql

Digging around, we found this issue reported on the container side: docker-library/mysql#750
Looking into this thread it seems that circleCI have fixed this by removing the MYSQL_USER="root".

Does testcontainers need to do the same?
Do you have another recommended way of getting test containers root user working with latest mysql container?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions