Use Docker Compose for MySQL
Using Docker, you can easily set up new MySQL instances.
I prefer to use Docker compose for that - here's my configuration file (which should also work for MariaDB-Containers):
services:
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'XXXXXXXX'
MYSQL_ROOT_PASSWORD: 'XXXXXXXX'
ports:
- '13306:3306'
volumes:
- ./mysql/3306:/var/lib/mysql
As in my environment, port 3306 is already used, I expose port 13306.
Image mysql:8.0
is the latest, at the moment 8.0.40
.
Keep in mind: Do not just upgrade from a later stable release to Innovation release mysql:innovation
. It will cause an error:
[ERROR] [MY-014060] [Server] Invalid MySQL server upgrade: Cannot upgrade from 80040 to 90100. Upgrade to next major version is only allowed from the last LTS release, which version 80040 is not.
Instead, you will have to first upgrade to the latest LTS release mysql:lts
:
[System] [MY-013381] [Server] Server upgrade from '80040' to '80403' started.
After that, an upgrade to innovation release mysql:innovation
can succesfully be done:
Data dictionary upgrading from version '80300' to '90000'.