MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
751 stars 436 forks source link

Dashes in username are not allowed #558

Closed dieechtenilente closed 4 months ago

dieechtenilente commented 4 months ago

Creating the following docker container

version: '2'

services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=apassword
      - MYSQL_PASSWORD=apassword
      - MYSQL_DATABASE=123-username-456
      - MYSQL_USER=123-username-456

results in a weird container with no 123-username-456 created.

grooverdan commented 4 months ago

thanks for the bug report.

grooverdan commented 4 months ago

Worked for me.

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.6.17-MariaDB-1:10.6.17+maria~ubu2004-log mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| 123-username-456   |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.001 sec)

MariaDB [(none)]> show create user '123-username-456';
+-------------------------------------------------------------------------------------------------------+
| CREATE USER for 123-username-456@%                                                                    |
+-------------------------------------------------------------------------------------------------------+
| CREATE USER `123-username-456`@`%` IDENTIFIED BY PASSWORD '*4173C3140D77328541B67BA0CCAEF93B4EF0A5A8' |
+-------------------------------------------------------------------------------------------------------+

Perhaps because the ./db was already initialized the environment variables didn't take effect.

Also FYI there is MARIADB_AUTO_UPGRADE=1 for upgrades and all MYSQL* variables have a MARIADB equivalent.

grooverdan commented 4 months ago

I added this test case into the tests, and it passes.