Skip to content

MySQL Helm chart with image version v9 causes "You have an error in your SQL syntax" error when "initdbScripts" is set #91705

@bszeti

Description

@bszeti

Name and Version

bitnami/mysql:9.6

What steps will reproduce the bug?

Deploy MySQL Helm chart (v.14.0.3) using image v9+ (e.g. 9.4.0-debian-12-r1) with "initdbScripts" set in values.yaml.
For example - values-test.yaml:

initdbScripts:
  init.sql: |
    -- Broken with MySQL 9
    GRANT ALL PRIVILEGES ON db1.* TO 'myuser'@'%';
    FLUSH PRIVILEGES;

Install helm chart:
helm upgrade -i -n mysql test oci://registry-1.docker.io/bitnamicharts/mysql -f values-test.yaml

Pod crashes with error in log:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'source /docker-entrypoint-initdb.d/init.sql' at line 1

What is the expected behavior?

The Pod should start successfully after executing the init.sql script. This works using MySQL images v8, but it fails using v9 images.

What do you see instead?

Error in Pod:

INFO ==> Starting mysql in background
INFO ==> Loading user's custom files from /docker-entrypoint-initdb.d
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'source /docker-entrypoint-initdb.d/init.sql' at line 1
ERROR ==> Failed executing /docker-entrypoint-initdb.d/init.sql
INFO ==> Stopping mysql

Additional information

This is probably caused by this line in bitnami/mysql/9.6/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh
https://github.com/bitnami/containers/blob/main/bitnami/mysql/9.6/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh#L453

Command like mysql <<< "source /docker-entrypoint-initdb.d/init.sql doesn't work in MySQL v9 images.

Metadata

Metadata

Assignees

Labels

mysqlsolvedstale15 days without activitytech-issuesThe user has a technical issue about an applicationtriageTriage is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions