mariadb-container icon indicating copy to clipboard operation
mariadb-container copied to clipboard

Pod creation fails inspite of MYSQL_ROOT_PASSWORD being present

Open dpkshetty opened this issue 3 years ago • 3 comments

I am trying to create a mariadb Pod that will have a db and tables pre-created. In order to achive that, I am using a Dockerfile as below

FROM registry.redhat.io/rhel8/mariadb-105

# needed for intialization
ENV MYSQL_ROOT_PASSWORD=root
ENV MYSQL_DATABASE=qod

COPY 1_createdb.sql /tmp/
COPY 2_authors.sql /tmp/
COPY 3_genres.sql /tmp/
COPY 4_quotes_sm.sql /tmp/

COPY run.sh /usr/share/container-scripts/mysql/init/

CMD ["run-mysqld"]

My github repo is: https://github.com/dpkshetty/qod-db/tree/v2

Inspite of MYSQL_ROOT_PASSWORD defined in the Dockerfile, the Pod fails to run and errors out with the below msg...

=> sourcing 20-validate-variables.sh ...
You must either specify the following environment variables:
  MYSQL_USER (regex: '^[a-zA-Z0-9_]+$')
  MYSQL_PASSWORD (regex: '^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$')
  MYSQL_DATABASE (regex: '^[a-zA-Z0-9_]+$')
Or the following environment variable:
  MYSQL_ROOT_PASSWORD (regex: '^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$')
Or both.
Optional Settings:
  MYSQL_LOWER_CASE_TABLE_NAMES (default: 0)
  MYSQL_LOG_QUERIES_ENABLED (default: 0)
  MYSQL_MAX_CONNECTIONS (default: 151)
  MYSQL_FT_MIN_WORD_LEN (default: 4)
  MYSQL_FT_MAX_WORD_LEN (default: 20)
  MYSQL_AIO (default: 1)
  MYSQL_KEY_BUFFER_SIZE (default: 32M or 10% of available memory)
  MYSQL_MAX_ALLOWED_PACKET (default: 200M)
  MYSQL_TABLE_OPEN_CACHE (default: 400)
  MYSQL_SORT_BUFFER_SIZE (default: 256K)
  MYSQL_READ_BUFFER_SIZE (default: 8M or 5% of available memory)
  MYSQL_INNODB_BUFFER_POOL_SIZE (default: 32M or 50% of available memory)
  MYSQL_INNODB_LOG_FILE_SIZE (default: 8M or 15% of available memory)
  MYSQL_INNODB_LOG_BUFFER_SIZE (default: 8M or 15% of available memory)

For more information, see https://github.com/sclorg/mariadb-container

dpkshetty avatar May 18 '22 19:05 dpkshetty

I even tried by specifying the env var at the time of deployment, but it still fails with the same error

image

dpkshetty avatar May 18 '22 19:05 dpkshetty

Even tried creating a secret with MYSQL_ROOT_PASSWORD and injecting it into the workload and it fails!

dpkshetty avatar May 18 '22 19:05 dpkshetty

Hi @dpkshetty. The MYSQL_ROOT_PASSWORD is mutually exclusive from MYSQL_DB. You have to use one or the other. If you are using MYSQL_DB, you also need to include MYSQL_USER and MYSQL_PASSWORD.

rydevops avatar Jul 20 '23 20:07 rydevops