#
Downgrade MySQL Version
In the AutoPilot interface, we do not allow downgrading the MySQL version because it can result in data loss. That being said, we can still downgrade the MySQL version manually for the client.
#
Prerequisites
- Dump database data or get confirmation from client that data loss is acceptable.
- SSH into the deployment's jump host.
- Login to the deployment's AWS account with the
ProdAutoPilotSupportLevelTworole.
#
Getting Server Ready
First we need to stop the MySQL service. This will require you to identify which instance the service is running on.
If you are inside an AIO deployment, then you can simply stop the service on that instance.
If you are inside a Cluster deployment, then you will need to ssh into the database instance.
You can get confirmation that you are on the right node by verifying the existence of the /mnt/database-data directory.
Run the following command to stop the MySQL service:
sudo systemctl stop mysql
Next, we are going to temporarily move the MySQL data directory to a backup location.
sudo mv /mnt/database-data/mysql /mnt/database-data/mysql.bak
#
Update MySQL Version
Now we are ready to downgrade the MySQL version through the CloudFormation stack. You will simply need to locate the parent stack for the deployment you are working on (not nested stack). Once you have located the parent stack, you will need to update the MySQL version in the parameters. Once you push the update, the CloudFormation stack will automatically downgrade the MySQL version for you and start the MySQL service. If all goes well, you should see the MySQL service running on the node and you can clean up the old MySQL data directory.
sudo rm -rf /mnt/database-data/mysql.bak