Sign inSign up

keygood/mariadb

By keygood

•Updated about 3 years ago

Image
0

546

keygood/mariadb repository overview

Main Mariadb parameters: MYSQL_DATABASE: specify the name of the database

MYSQL_USER: specify the User for the database

MYSQL_PASSWORD: specify the User password for the database

MYSQL_ROOT_PASSWORD: specify the root password for Mariadb

MYSQL_CHARSET: default charset (utf8) for Mariadb

MYSQL_COLLATION: default collation (utf8_general_ci) for Mariadb

List of Character Sets & information When setting charset, also make sure to choose a collation otherwise it will be the default.

https://mariadb.org/⁠

Creating an instance docker run -it --name mysql -p 3306:3306 -v /var/lib/mysql:/var/lib/mysql -e MYSQL_DATABASE=wordpressdb -e MYSQL_USER=wordpressuser -e MYSQL_PASSWORD=hguyFt6S95dgfR4ryb -e MYSQL_ROOT_PASSWORD=hguyFtgfR4r9R4r76 yobasystems/alpine-mariadb

It will create a new db, and set mysql root password (default is RaNd0MpA$$W0Rd generated by pwgen) unless the data already exists.

Configuration without a cnf file Many configuration options can be passed as flags to mysqld. This will give you the flexibility to customise the container without needing a .cnf file. For example, if you want to change the default encoding and collation for all tables to use UTF-8 (utf8mb4) just run the following:

docker run --name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d yobasystems/alpine-mariadb --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci command:

--character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1 Configuration file location The configuration file is located;

/etc/my.cnf /etc/my.cnf.d/mariadb-server.cnf Initialising a fresh instance When a container is started for the first time, a new database with the specified name will be created and initialised with the provided configuration variables. Furthermore, it will execute files with extensions .sh, .sql and .sql.gz that are found in /docker-entrypoint-initdb.d. Files will be executed in alphabetical order. You can easily populate your mariadb services by mounting a SQL dump into that directory and provide custom images with contributed data. SQL files will be imported by default to the database specified by the MYSQL_DATABASE variable.

Docker Compose example: (Please pass your own credentials or let them be generated automatically, don't use these ones for production!!) mysql: image: yobasystems/alpine-mariadb environment: MYSQL_ROOT_PASSWORD: hguyFtgfR4r9R4r76 MYSQL_DATABASE: wordpressdb MYSQL_USER: wordpressuser MYSQL_PASSWORD: hguyFt6S95dgfR4ryb expose: - "3306" volumes: - /data/example/mysql:/var/lib/mysql restart: always

Tag summary

Content type

Image

Digest

sha256:9d6f778d1…

Size

68.3 MB

Last updated

about 3 years ago

docker pull keygood/mariadb:10.6.14