Open MychauU opened 2 weeks ago
Hi, can you try adding mysql-default-conf/my.cnf
with the following content https://github.com/testcontainers/testcontainers-java/blob/1.19.3/modules/mysql/src/main/resources/mysql-default-conf/my.cnf in your project?
@eddumelendez It doesn't help.
I added it to resources. As I wasnt sure if it was included it container I exported filesystem of container using docker export
and file was added correctly to /etc/mysql/conf.d
still error persists:
2024-09-12T09:27:09.350+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] org.testcontainers.DockerClientFactory : Docker host IP address is localhost
2024-09-12T09:27:09.362+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] org.testcontainers.DockerClientFactory : Connected to docker:
Server Version: 27.1.1
API Version: 1.46
Operating System: Ubuntu 22.04.4 LTS
Total Memory: 64030 MB
2024-09-12T09:27:09.405+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] tc.testcontainers/ryuk:0.7.0 : Creating container for image: testcontainers/ryuk:0.7.0
2024-09-12T09:27:09.445+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] o.t.utility.RegistryAuthLocator : Credential helper/store (docker-credential-desktop) does not have credentials for https://index.docker.io/v1/
2024-09-12T09:27:09.533+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] tc.testcontainers/ryuk:0.7.0 : Container testcontainers/ryuk:0.7.0 is starting: 90e266c3669542e077b4172a875476d3e5a35aac02edac4ba8933eaf2678b633
2024-09-12T09:27:09.776+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] tc.testcontainers/ryuk:0.7.0 : Container testcontainers/ryuk:0.7.0 started in PT0.370628063S
2024-09-12T09:27:09.778+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] o.t.utility.RyukResourceReaper : Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
2024-09-12T09:27:09.779+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] org.testcontainers.DockerClientFactory : Checking the system...
2024-09-12T09:27:09.779+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] org.testcontainers.DockerClientFactory : ✔︎ Docker server version should be at least 1.6.0
2024-09-12T09:27:09.781+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] tc.mysql:5.5.62 : Creating container for image: mysql:5.5.62
2024-09-12T09:27:09.835+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] tc.mysql:5.5.62 : Container mysql:5.5.62 is starting: eb4fb898553cd9f068483faee0f78f8da6237ac7a8f4bedc9a619fb339b214d3
2024-09-12T09:27:09.969+02:00 INFO 70971 --- [t24-integration-daemon] [ Test worker] tc.mysql:5.5.62 : Waiting for database connection to become available at jdbc:mysql://localhost:32769/lmms using query 'SELECT 1'
2024-09-12T09:29:09.985+02:00 ERROR 70971 --- [t24-integration-daemon] [ Test worker] tc.mysql:5.5.62 : Could not start container
java.lang.IllegalStateException: Wait strategy failed. Container exited with code 1
docker logs of mysql container:
ERROR: mysqld failed while attempting to check config
command was: "mysqld --verbose --help --log-bin-index=/tmp/tmp.C9yqLOxldI"
240912 7:29:10 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
240912 7:29:10 [Note] mysqld (mysqld 5.5.62) starting as process 10 ...
240912 7:29:10 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
240912 7:29:10 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
240912 7:29:10 [ERROR] mysqld: unknown variable 'host_cache_size=0'
240912 7:29:10 [ERROR] Aborting
Adding it only to resources is not enough when using the JDBC integration, you also have to change the JDBC URL accordingly (did you do it?), see https://java.testcontainers.org/modules/databases/mysql/#overriding-mysql-mycnf-settings.
jdbc:tc:mysql:8.0.36://hostname/databasename?TC_MY_CNF=somepath/mysql_conf_override
Module
MySQL
Testcontainers version
1.18.3
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host Arch
x86_64
Docker version
What happened?
When I try to update testcontainers dependency to newest version (1.20.1) mysql container cannot start. On version 1.18.3 it works.
Logs from docker container started by ryuk (mysql container)
Project is using gradle for building. Relevant dependency:
I start container by properties configuration:
Relevant log output
Additional Information
No response