MySQL to MariaDB and Back Again benny Vasquez -- cPanel, Inc. - - PowerPoint PPT Presentation

mysql to mariadb and back again
SMART_READER_LITE
LIVE PREVIEW

MySQL to MariaDB and Back Again benny Vasquez -- cPanel, Inc. - - PowerPoint PPT Presentation

MySQL to MariaDB and Back Again benny Vasquez -- cPanel, Inc. Santa Clara, California | April 23th 25th, 2018 hi, I'm benny. 2 right now 3 before cPanel 4 boring 5 boring 6 enough about me, though 7 Migrating your data safely


slide-1
SLIDE 1

MySQL to MariaDB and Back Again

benny Vasquez -- cPanel, Inc. Santa Clara, California | April 23th – 25th, 2018

slide-2
SLIDE 2 2

hi, I'm benny.

slide-3
SLIDE 3 3

right now

slide-4
SLIDE 4 4

before cPanel

slide-5
SLIDE 5 5

boring

slide-6
SLIDE 6 6

boring

slide-7
SLIDE 7 7

enough about me, though

slide-8
SLIDE 8

Migrating your data safely

slide-9
SLIDE 9

Migrating your data safely

STOP

slide-10
SLIDE 10 10

Step 0: Backup!

slide-11
SLIDE 11 11

Step 0: Backup!

Step -1: Check yo self

  • Partition space is important

df ; df –I

Step 0.1: Full dumps of your database (scheme optional)

  • Use mysqldump

[root: ~]# mysqldump -u root -p mysql user > `date +%Y%m%d`.user_table_dump.sql [root: ~]# mysqldump -u root -p --all-databases --skip-lock-tables > `date +%Y%m%d`.alldb.sql

Step 0.2: backup of the folder(s) and configurations

  • Use cp, rsync, etc
  • cp -a /var/lib/mysql{,.back. `date +%Y%m%d`} ; cp -a /etc/my.cnf{,.back.`date +%Y%m%d`}

Step 0.3: full server backups

  • Wherever possible, hot-spare is your best bet.
slide-12
SLIDE 12

The Environment(s)

Let’s get on the same page

slide-13
SLIDE 13 13

Env{1} * CentOS 6.9 * Installed MySQL 5.5 * Installed Apache & PHP * Added WordPress Site

The Environment(s)

Env{2} * CentOS 6.9 * Installed cPanel & WHM * installed w/MySQL 5.5 * Added WordPress Site

slide-14
SLIDE 14

MySQL à MariaDB

Fo’ reals this time.

slide-15
SLIDE 15 15

6 easy steps

  • Install the MariaDB repos

https://mariadb.com/kb/en/library/yum/

  • Stop MySQL and remove it

service mysqld stop; yum remove mysql-community-server

  • Install MariaDB with your package manager

yum install MariaDB-server MariaDB-client

  • Ensure MariaDB is running

service mysql start mysql -V service mysql status

  • Run mysql_upgrade

Finish the conversion

Things to keep in mind

  • Migrate to the same version
  • MySQL 5.1 -> MariaDB 5.1
  • MySQL 5.5 -> MariaDB 5.5
  • MySQL 5.6 -> MariaDB 10.0
  • MySQL 5.7 -> MariaDB 10.2

MySQL to MariaDB; Env{1} Great Success

Env{1}: Success

slide-16
SLIDE 16 16

3 easy steps

  • Navigate to MySQL/MariaDB Upgrade
  • Acknowledge the warnings
  • Click continue

MySQL to MariaDB; Env{2} Great Success

Env{2}: Success

slide-17
SLIDE 17

MariaDB à MySQL under 5.6

Easy peasy

slide-18
SLIDE 18 18

6 easy steps

  • Stop MariaDB

service mysql stop

  • Remove MariaDB and its repos

yum remove MariaDB-server MariaDB-client

  • Install MySQL
  • Ensure MySQL is running
  • mysql_upgrade

Things to keep in mind

  • Migrate to the same version
  • MariaDB 5.1 -> MySQL 5.1
  • MariaDB 5.5 -> MySQL 5.5

MariaDB to MySQL, when < 5.6 Env{1} Great Success

Env{1}: Success

slide-19
SLIDE 19 19

2 easy steps

  • Manually adjust the mysql-version in /var/cpanel/cpanel.config

[root: ~]# grep mysql-version /var/cpanel/cpanel.config mysql-version=5.5

  • Tell cPanel to check the installed RPMs and fix any problems it encounters

/scripts/check_cpanel_rpms targets=MySQL55,MySQL56,MySQL57,MariaDB100 --fix

Env{2}: Success

MariaDB to MySQL, when < 5.6 Env{2} Great Success

slide-20
SLIDE 20

MariaDB à MySQL over 5.6

ugh

slide-21
SLIDE 21 21

7 easy steps

  • DUMP. YOUR. DATABASES. And privileges.
  • Stop MariaDB

service mysql stop

  • Remove your databases

cp -a /var/lib/mysql{,.bak}; rm -rf /var/lib/mysql; chown mysql. /var/lib/mysql

  • Remove MariaDB and its repos

yum remove MariaDB-server MariaDB-client

  • Install MySQL
  • Grab the community repo, and then yum install it

https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/linux-installation- yum-repo.html

  • Ensure MySQL is running

service mysql status

  • Restore your databases
  • If you’ve done good, beer.

Warning: swapping in place WILL corrupt your databases

MariaDB to MySQL, when ≥ 5.6 Env{1} eh Success

Env{1}: Success?

slide-22
SLIDE 22 22

6 easy steps

  • DUMP. YOUR. DATABASES. And privileges.
  • Remove your database files

cp -a /var/lib/mysql{,.bak}; rm -rf /var/lib/mysql; chown mysql. /var/lib/mysql

  • Manually adjust the mysql-version in /var/cpanel/cpanel.config

[root: ~]# grep mysql-version /var/cpanel/cpanel.config mysql-version=5.7

  • Tell cPanel to check the installed RPMs and fix any problems it encounters

/scripts/check_cpanel_rpms –fix

  • Ensure MySQL is running

service mysql status

  • Restore your databases
  • Also earns beer.

Warning: ”downgrading” in place WILL corrupt your databases, and WILL increase headaches.

MariaDB to MySQL, when ≥ 5.6 Env{2} eh Success

Env{2}: Success?

slide-23
SLIDE 23

Conclusions and take-aways

ugh

slide-24
SLIDE 24 24

ugh.

  • If you can, avoid changes after 5.7/10.2
  • Test, tinker, make notes
  • Be prepared for the suck, and maybe you’ll have over estimated.
  • Always reward yourself.
slide-25
SLIDE 25 25
slide-26
SLIDE 26

Thank You!

benny@cpanel.net

LAMP installation, to build your env mysqldump, for your backups Install MySQL 5.7 on your server cPanel docs for upgrade scheme optional

https://go.cpanel.net/pl18

slide-27
SLIDE 27 27

Rate My Session