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.7 and docker image pull mysql:8
  • Locate your mysql data folder. Something like /var/lib/mysql

MySQL 5.6 to 5.7[edit]

  1. Launch the container with docker run -it --rm -v /yourlocaationto/mysql:/var/lib/mysql -p 8686:3306 --entrypoint bash --name mysqlupgrade mysql:5.7 and you should automatically be inside the container tty
  2. Get package list and install screen apt-update ; apt-get install screen
  3. Start a screen session screen -S server
  4. Try to start the mysql server mysqld --skip-grant-tables
  5. If the mysqld intance doesn't die simply hit ctrl+a ctrl+d
    1. 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.cnf example: 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
  6. Start the Upgrade procedure mysql_upgrade -uroot -p
  7. If it works, shutdown the mysql server mysqladmin -uroot -p shutodown
  8. Enter the session screen -r server and start mysql again mysqld without --skip-grant-table
  9. If the server comes up without errors then you are fine, don't ctrl+c . Exit the screen ctrl+a ctrl+d, then mysqladmin -uroot -p shutodown and after a few seconds ctrl + d

MySQL 5.7 to 8[edit]

  1. docker run -it --rm -v /mylocationwhere/mysqlis:/var/lib/mysql -p 8686:3306 --entrypoint bash --name mysqlupgrade mysql:8
  2. apt-update ; apt-get install screen
  3. screen -S server
  4. mysqld
  5. ctrl+a ctrl+d
  6. mysqladmin -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