Skip to content

MySql Command is override on start #534

@AlissonMedeiros

Description

@AlissonMedeiros

When I start a new MySql container I set a diferent command, but this is override per the method "configure()"

My code:

(MySQLContainer) new MySQLContainer()
                .withDatabaseName("f"+timeStamp)
                .withUsername("f"+timeStamp)
                .withPassword("f"+timeStamp)
                .withCommand("mysqld", "--lower_case_table_names=1")
                .withLogConsumer(new Slf4jLogConsumer(logger));

The code of MYSQLContainer:

    @Override
    protected void configure() {
        optionallyMapResourceParameterAsVolume(MY_CNF_CONFIG_OVERRIDE_PARAM_NAME, "/etc/mysql/conf.d", "mysql-default-conf");

        addExposedPort(3306);
        addEnv("MYSQL_DATABASE", databaseName);
        addEnv("MYSQL_USER", username);
        addEnv("MYSQL_PASSWORD", password);
        addEnv("MYSQL_ROOT_PASSWORD", "test");
        setCommand("mysqld");
        setStartupAttempts(3);
    }

I need this to support case insentive. Do you know athoner way to do this? If not I can fix and open PR.

Another option is add lower_case_table_names=1" in the file my.cnf Or have
a way to add more configurations in the file.

Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions