MariaDB is (mostly) a drop-in replacement for MySQL, so you can use the same tools and commands as you would with MySQL.
We use the official MariaDB image.
Parameter | Value |
---|---|
Connection | Standard TCP/IP |
Host | mysql (from a container)localhost (from your computer) |
Port | 3306 |
Username | root |
Password | dbroot (this can be changed in .env ) |
If you're looking for a suitable desktop app, we recommend TablePlus or MySQL Workbench.
See mysql/data/
.
All database data is stored on your host machine (not inside the docker container). This makes it simple to update your Docker Dev environment without losing any data.
Warning: It is very easy to break your database if you touch any files in there. We recommend keeping SQL dumps of anything important.
Prevention is always better than cure. We recommend keeping backups of anything important.
If you break the ownership permissions on MariaDB's "data" folder, try:
docker compose run mysql chown -R root:mysql /var/lib/mysql/*
You can start from scratch by wiping the mysql/data/
folder:
- Stop all containers:
docker compose stop
- Delete the
mysql/data/
folder - Recreate the
mysql/data/
folder - Start all containers:
docker compose up -d
If you have previously used MariaDB then simply changing MYSQL_ROOT_PASSWORD
in .env
will not work. Instead, you will need to:
- Update
MYSQL_ROOT_PASSWORD
in.env
, to your new password - Build, start and exec into your MariaDB container:
docker compose exec mysql bash
- Log into MariaDB using the old password:
mysql -u root -p
- Execute the following:
use mysql;
update user set authentication_string=password('YOUR_NEW_PASSWORD_HERE') where user='root';
flush privileges;
quit;