MariaDB / mariadb-docker

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

Is it possible to create user with empty/no password? #347

Closed ioquatix closed 3 years ago

ioquatix commented 3 years ago

https://github.com/docker-library/mariadb/blob/58bef417cbeea4eb6b15c46b6097c3cbb99beb32/docker-entrypoint.sh#L266

It seems like only specifying MYSQL_USER is not sufficient. But setting MYSQL_PASSWORD to an empty string also wont work since based on my understanding of bash it won't differentiate.

This is for unit testing, we don't need any password.

wglambert commented 3 years ago

https://github.com/docker-library/docs/tree/master/mariadb#mysql_allow_empty_password 😉

$ docker run -d --name mariadb -e MYSQL_ALLOW_EMPTY_PASSWORD=1 mariadb
677aeab3712eb662965ba05d66c6ebafeacf57a59ca70a2055408e751f6382aa

$ docker exec -it mariadb mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.8-MariaDB-1:10.5.8+maria~focal 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)]>
ioquatix commented 3 years ago

Thanks!