MySQL 9.7 Upgrade Procedure
MySQL 8.0 has reached End of Life. Therefore, MISP instances deployed using the Jisc CTI images before October 2026 need their database engine upgrading to MySQL 9.7, which will be supported by Oracle until April 2034.
The steps in this procedure must be followed in order to avoid irrecoverable loss of access to the database.
To check which database engine your environment is running:
- Move to the MISP directory using:
cd /opt/misp - List the images in use using:
grep image docker-compose.yml- if
image: mysql:9.7is listed - no action is required. - If
image: mysql/mysql-server:8.0is listed, follow this procedure to upgrade.
- if
Initial State
If this procedure applies to you, the db service in your docker-compose.yml file will look like
this:
db:
command: [mysqld, --default-authentication-plugin=mysql_native_password, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb_monitor_enable=all]
environment:
- FQDN=${FQDN:-misp.local}
- HTTPS_PORT=${HTTPS_PORT:-443}
- MYSQL_DATABASE=${MYSQL_DBNAME:-misp}
- MYSQL_USER=${MYSQL_USERNAME:-misp}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-misp}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-misp}
hostname: ${MYSQL_HOSTNAME:-misp_db}
image: mysql/mysql-server:8.0
restart: unless-stopped
volumes:
- ./persistent/${COMPOSE_PROJECT_NAME}/db:/var/lib/mysql
Stop MISP
To ensure data consistency it is essential MISP remains shut down throughout the procedure.
Stop MISP using: docker compose down
Back Up
Ensure you take a full Backup of your instance before following this procedure.
The database will be irreversibly re-encoded, meaning you will not be able to swap the image back to MySQL 8.0 if issues arise as it will not be able to read the data files.
Migrate Password Encoding
Native authentication is not supported by MySQL 9.7. Therefore, you must re-encode the root and
misp account passwords into a supported format (caching_sha2_password) before proceeding.
- Start only the database service using:
docker compose up -d db - Open an interactive shell inside the container using:
docker compose exec -it db bash - Load the
rootpassword into theMYSQL_PWDvariable using:export MYSQL_PWD=$MYSQL_ROOT_PASSWORD - Re-encode the
rootaccount password using:echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '$MYSQL_ROOT_PASSWORD';" | mysql - Re-encode the
mispaccount password using:echo "ALTER USER 'misp'@'%' IDENTIFIED WITH caching_sha2_password BY '$MYSQL_PASSWORD';" | mysql - Exit the shell using:
exit - Stop the database container using:
docker compose down
Upgrade Database Files from 8.0 to 8.4
It is not possible to upgrade straight from 8.0 to 9.7, an intermediate step to 8.4 is required first.
-
Edit the
commandandimageoptions and add thehealthcheckoption to thedbservice in yourdocker-compose.ymlfile as below:docker-compose.ymldb: command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb_monitor_enable=all] environment: - FQDN=${FQDN:-misp.local} - HTTPS_PORT=${HTTPS_PORT:-443} - MYSQL_DATABASE=${MYSQL_DBNAME:-misp} - MYSQL_USER=${MYSQL_USERNAME:-misp} - MYSQL_PASSWORD=${MYSQL_PASSWORD:-misp} - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-misp} healthcheck: test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] hostname: ${MYSQL_HOSTNAME:-misp_db} image: mysql:8.4 restart: unless-stopped volumes: - ./persistent/${COMPOSE_PROJECT_NAME}/db:/var/lib/mysql -
Start the database server and monitor the startup using:
docker compose up db - Wait for
ready for connections. Version: '8.4.9' ...to be logged - Shutdown the database container by pressing CTRL+C
Upgrade Database Files from 8.4 to 9.7
Now the database files are in 8.4 format, they can be upgraded to 9.7 format.
-
Update the
imageoption of thedbservice in yourdocker-compose.ymlfile as below:docker-compose.ymldb: command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb_monitor_enable=all] environment: - FQDN=${FQDN:-misp.local} - HTTPS_PORT=${HTTPS_PORT:-443} - MYSQL_DATABASE=${MYSQL_DBNAME:-misp} - MYSQL_USER=${MYSQL_USERNAME:-misp} - MYSQL_PASSWORD=${MYSQL_PASSWORD:-misp} - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-misp} healthcheck: test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] hostname: ${MYSQL_HOSTNAME:-misp_db} image: mysql:9.7 restart: unless-stopped volumes: - ./persistent/${COMPOSE_PROJECT_NAME}/db:/var/lib/mysql -
Start the database server and monitor the startup using:
docker compose up db - Wait for
ready for connections. Version: '9.7.0' ...to be logged - Shutdown the database container by pressing CTRL+C
Start MISP
The database migration is now complete. MISP can now be safely started.
- Start MISP using:
docker compose up -d - Monitor the web containers startup to ensure no errors occur using:
docker compose logs -f web
Cleanup Old Images
Finally, you can clean up unneeded Docker objects, including the MySQL 8.0 and 8.4 images using:
docker system prune -a -f.