Ayase/DatabaseMigrationPath: Difference between revisions
From Bibliotheca Anonoma
(MySQL upgrade path 5.6 > 5.7 > 8) |
(No difference)
|
Latest revision as of 23:03, 1 February 2021
Database Upgrade[edit]
MySQL Docker[edit]
A barebone description of the Upgrade Path from 5.6 to 8. If you want you can simply stop in the middle.
Create a backup, I'm not responsible for your birdbrain fuckups.
- Install Docker
- Pull
docker image pull mysql:5.7anddocker image pull mysql:8 - Locate your mysql data folder. Something like
/var/lib/mysql
MySQL 5.6 to 5.7[edit]
- Launch the container with
docker run -it --rm -v /yourlocaationto/mysql:/var/lib/mysql -p 8686:3306 --entrypoint bash --name mysqlupgrade mysql:5.7and you should automatically be inside the container tty - Get package list and install screen
apt-update ; apt-get install screen - Start a screen session
screen -S server - Try to start the mysql server
mysqld --skip-grant-tables - If the mysqld intance doesn't die simply hit
ctrl+a ctrl+d- If it crashes, figure out why. Maybe you had something in the config that it needs? Then mount the config file
-v /whereever/my.cnf:/etc/mysql/my.cnfexample:docker run -it --rm -v /yourlocaationto/mysql:/var/lib/mysql -v /whereever/my.cnf:/etc/mysql/my.cnf -p 8686:3306 --entrypoint bash --name mysqlupgrade mysql:5.7
- If it crashes, figure out why. Maybe you had something in the config that it needs? Then mount the config file
- Start the Upgrade procedure
mysql_upgrade -uroot -p - If it works, shutdown the mysql server
mysqladmin -uroot -p shutodown - Enter the session
screen -r serverand start mysql againmysqldwithout --skip-grant-table - If the server comes up without errors then you are fine, don't
ctrl+c. Exit the screenctrl+a ctrl+d, thenmysqladmin -uroot -p shutodownand after a few secondsctrl + d
MySQL 5.7 to 8[edit]
docker run -it --rm -v /mylocationwhere/mysqlis:/var/lib/mysql -p 8686:3306 --entrypoint bash --name mysqlupgrade mysql:8apt-update ; apt-get install screenscreen -S servermysqldctrl+a ctrl+dmysqladmin -uroot -p shutodown
Mysqld should automatically start the upgrade procedure, it will run through and complain about plugins that you can remove later on (https://dba.stackexchange.com/a/65799)
From here you can start the container normally, pointing to the mysql dir path that was upgraded