More Related Content Similar to MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.0 (20) More from Olivier DASINI (20) MySQL Day Paris 2018 - Upgrade from MySQL 5.7 to MySQL 8.01. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Upgrade from MySQL 5.7 to MySQL 8.0
Olivier Dasini
MySQL Principal Solutions Architect EMEA
olivier.dasini@oracle.com
Twitter : @freshdaz
Blog : http://dasini.net/blog
2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is
intended for information purposes only, and may not be incorporated
into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing
decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole
discretion of Oracle.
2
3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Me, Myself & I
➢
MySQL Geek
✔ Addicted to MySQL for 15+ years!
✔ Playing with databases for 20+ years
➢
MySQL Writer, Blogger and Speaker
✔ Also former : DBA, Consultant, Architect, Trainer, ...
➢
MySQL Principal Solutions Architect EMEA at Oracle
➢
Stay tuned! :
✔ Twitter : @freshdaz
✔ Blog : http://dasini.net/blog
3
Olivier DASINI
4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Why upgrade?
• New features
– MySQL JSON Document Store, CTE, Window Functions, JSON, GIS, …
• Security improvements
– New Authentication Plugin, SQL Roles, Undo/Redo & Tablespaces Encryption, …
• Performance/Scalability improvements
– Cost Model, Histograms, P_S, I_S, Scaling R/W workloads, Resource Groups, …
• Manageability
– Set Persist, Invisible Indexes, Restart command, Instant Add Column, …
• Reduce tech debt for the MySQL installation
• Stay on fully supported release
• …
4
5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Support Life Cycle
Release GA Date Premier Support End Extended Support End Sustaining Support End
MySQL 5.0 Oct 2005 Dec 2011 N/A Indefinite
MySQL 5.1 Dec 2008 Dec 2013 N/A Indefinite
MySQL 5.5 Dec 2010 Dec 2015 Dec 2018 Indefinite
MySQL 5.6 Feb 2013 Feb 2018 Feb 2021 Indefinite
MySQL 5.7 Oct 2015 Oct 2020 Oct 2023 Indefinite
MySQL 8.0 Apr 2018 Apr 2023 Feb 2026 Indefinite
5
http://www.oracle.com/us/support/library/lifetime-support-technology-069183.pdf
6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Why upgrade? - MySQL 8.0 Security improvement
6
• SSL enabled by default
• Force root password during install
• Stronger passwords
• New Authentication Plugin
• MySQL Enterprise Edition:
– MySQL Audit
– MySQL Monitor
– MySQL Backup
– MySQL Firewall
– MySQL Encryption
– MySQL Transparent Data Encryption
– MySQL Data Masking and De-identification
– MySQL Thread Pool
• https://dev.mysql.com/doc/mysql-security-excerpt/8.0/en/
7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
7
OS : Oracle Linux 7.4
CPU : 48cores-HT Intel Skylake 2.7Ghz
(2CPU sockets, Intel(R) Xeon(R) Platinum 8168 CPU)
RAM: 256GB
Storage : x2 Intel Optane flash devices
(Intel (R) Optane (TM) SSD P4800X Series)
MySQL 8.0 Sysbench Benchmark
Why upgrade? - Better performance: Reads & Writes
OS : Oracle Linux 7.4
CPU : 48cores-HT Intel Skylake 2.7Ghz
(2CPU sockets, Intel(R) Xeon(R) Platinum 8168 CPU)
RAM: 256GB
Storage : x2 Intel Optane flash devices
(Intel (R) Optane (TM) SSD P4800X Series)
IO Bound Read Only (Point Selects) Read Write (update nokey)
http://dimitrik.free.fr/blog/posts/mysql-performance-1m-iobound-qps-with-80-ga-on-intel-optane-ssd.html
http://dimitrik.free.fr/blog/posts/mysql-performance-80-and-sysbench-oltp_rw-updatenokey.html
8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Upgrade – Supported Paths
• All minor upgrades like 5.7.21 to 5.7.22 or doing a jump like 5.7.20 to 5.7.24
is supported
• Upgrading one major (5.6 - 5.7) release level is supported
– It’s recommended upgrading to the latest 5.6 release before moving to 5.7
• Doing long-jumps (5.1 – 5.7) is supported if you upgrade one release level at a
time
– 5.1 → 5.5 → 5.6 → 5.7 → 8.0
• Direct upgrades that skip a release level (for example, upgrading directly from
MySQL 5.5 to 8.0) is not recommended
• Yon can not upgrade from DMR to GA
8
9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Overview of MySQL 8.0 features
• What’s New in MySQL 8.0? (Generally Available)
– https://mysqlserverteam.com/whats-new-in-mysql-8-0-generally-available/
• Changes in MySQL 8.0.11 (General Availability)
– https://mysqlserverteam.com/changes-in-mysql-8-0-11-general-availability/
• The MySQL 8.0.12 Maintenance Release is Generally Available
– https://mysqlserverteam.com/the-mysql-8-0-12-maintenance-release-is-generally-available/
• The MySQL 8.0.13 Maintenance Release is Generally Available
– https://mysqlserverteam.com/the-mysql-8-0-13-maintenance-release-is-generally-available/
9
10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL 8.0 Deprecation/Removals - Samples
• Features removed
– Query Cache, Non-native partitioning, ...
• Options and variables removed
– Log_errors/log_warnings replaced by log_error_verbosity
– SQL Modes removed
– ...
• Account management
– The PASSWORD() function has been removed, using GRANT to create users is no longer
supported
• Syntaxes affected
– EXTENDED and PARTITIONS keywords for EXPLAIN removed
– N as a synonym for NULL in SQL removed. Use NULL instead
10
11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL 8.0 Defaults Changes - Samples
• There are a lot of changes to the defaults in 8.0, see
– https://mysqlserverteam.com/new-defaults-in-mysql-8-0/
• Some important ones:
– Default character set and collation to utf8mb4 and utf8mb4_0900_ai_ci
– The default/preferred authentication plugin caching_sha2_password
– innodb_undo_tablespaces changed from 0 to 2
– log_bin has been changed from OFF to ON
11
12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
New Servers Default’s in MySQL 8.0
• charset_set_server=utf8mb4
• collation_server=utf8mb4_0900_ai_ci
• validate_password_check_user_name=ON
• event_scheduler=ON
• log_bin=ON
• server_id=1
• log-slave-updates=ON
• expire_log_days=30
• master-info-repository=TABLE
• relay-log-info-repository=TABLE
• transaction-write-set-extraction=XXHASH64
• … and many more, see link below for more details
12
https://mysqlserverteam.com/new-defaults-in-mysql-8-0/
13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Upgrade – Before you start!
• Review "Changes in MySQL 8.0" for changes that may require action before
upgrading
– https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html
• Review "What Is New in MySQL 8.0" for deprecated and removed features.
– https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html
• Review "Server and Status Variables and Options Added, Deprecated, or
Removed in MySQL 8.0".
– If you use deprecated or removed variables, an upgrade may require configuration changes.
– https://dev.mysql.com/doc/refman/8.0/en/added-deprecated-removed.html
• Review "Release Notes" for information about fixes, changes, and new features.
– https://dev.mysql.com/doc/relnotes/mysql/8.0/en/
• Create a plan for your upgrade/downgrade path
13
https://dev.mysql.com/doc/refman/8.0/en/upgrade-before-you-begin.html
14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Before you Upgrade – Backups of Your Data!
• Database upgrading is very serious work!
– So backup your data!
• Plan for the worst - Paranoia is not always a bad things
– So backup your data!
• Use your favorite backup tool
– MySQL Enterprise Backup
– mysqldump
– …
• Double check your backups
• Test your Restore procedure
14
Credit: https://tricyclefish.com/wp-content/uploads/2016/01/back-up1.jpg
15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Is your MySQL server instance ready for upgrade?
15
16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Is your MySQL server instance ready for upgrade?
17
• Preliminary checks...
1. Usage of old temporal type?
2. Conflicting db object names and reserved keywords?
3. Usage of utf8mb3 charset?
4. Reserved tablenames in mysql schema?
5. FK names longer than 64 chars?
6. Usage of obsolete sql_mode?
7. ENUM/SET column definitions containing elements longer than 255 characters?
8. Usage of partitioned tables in shared tablespaces?
9. Usage of removed functions?
10.Usage of removed GROUP BY ASC/DESC?
11.Issues reported by ”check table x for upgrade” command?
– ...
https://dev.mysql.com/doc/refman/8.0/en/upgrade-prerequisites.html
Credit: https://emojiisland.com/products/omg-face-emoji-icon
17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Upgrade Checker Utility
18
Credit: https://emojiisland.com/products/thumbs-up-hand-sign-emoji-icon
18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Upgrade Checker Utility - checkForServerUpgrade
19
• New tool in MySQL Shell
– JS> util.checkForServerUpgrade()
• Will check your MySQL 5.7 or 8.0 installation readiness for upgrade
– Check for legacy issues
– Running the tool on the 5.7 installation, users can make changes when time
permits before the upgrade
• It is in active development and more checks will be added
– Part of MySQL update releases
mysqlsh -- util check-for-server-upgrade { --user=root --host=172.25.0.10 }
mysqlsh -e "util.checkForServerUpgrade({user:'root', host:'172.25.0.10'})"
MYSQL JS> util.checkForServerUpgrade("root@172.25.0.10", {outputFormat:'JSON'})
Examples:
https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-utilities-upgrade.html
19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Upgrade Checker Utility - checkForServerUpgrade
20
20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Your MySQL server instance is ready for upgrade!
21
o/
21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Wait!!!
22
:-0
22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Before you Upgrade – Backups of Your Data!
Did I mention BACKUP?
23
;-)
23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
In-place Upgrade
24
24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Upgrade – In-place Upgrade
1. Do all necessary preparations/plans/upgrade checker as explained earlier
– e.g. mysqlsh -- util check-for-server-upgrade { --user=root --host=172.25.0.10 }
2. Create a backup of your database (data, logs, config files)
3. Do a graceful shutdown of MySQL (innodb_fast_shutdown=0)
4. Install MySQL 8.0, replace the old binaries with the new ones
5. Start new MySQL 8.0 Server using new binaries and new my.cnf
6. Run mysql_upgrade
– mysql_upgrade examines all tables in all databases for incompatibilities with the current version of
MySQL.
– mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or
capabilities.
7. Restart the server and look at messages in the error log
8. Verify that apps and services are working as expected
25
25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Caching SHA-2 Pluggable Authentication
26
26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
caching_sha2_password
27
• caching_sha2_password : new default Authentication plugin in 8.0
– Requires password exchange using a secure connection
●
TCP using TLS/SSL credentials,
●
a Unix socket file, or shared memory,
●
or an unencrypted connection that supports password exchange using an
RSA key pair
– Then cached a copy of the password hash in memory
– MySQL 5.7 default is mysql_native_password
●
Relies on SHA1 algorithm and NIST has suggested to stop using it
27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
caching_sha2_password
28
• New users created in MySQL 8.0 will use the
caching_sha2_password as their authentication plugin
– User accounts already created in existing instances are not altered
as a part of an upgrade
ALTER USER 'daz'@'localhost'
IDENTIFIED WITH caching_sha2_password
BY 'password';
Examples: Existing users who wish to switch to caching_sha2_password
28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
caching_sha2_password - Issues
29
• If you encounter compatibility issues after upgrading to MySQL 8.0 the
simplest way to address those issues is to reconfigure the server to
revert to the previous default authentication plugin,
mysql_native_password :
Examples:
[mysqld]
default_authentication_plugin=mysql_native_password
• This setting should be viewed as temporary, not as a long term or
permanent solution
https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
https://mysqlserverteam.com/mysql-8-0-4-new-default-authentication-plugin-caching_sha2_password/
29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Keep in mind
30
30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Upgrade – Keep in mind!
• Performance/Scalability monitoring and testing
– Consider MySQL Enterprise Monitor 8.0
• Do you need to consider replication between different versions
– Primary:5.7 → Replica: 8.0
• Changes in default values
• Statements creating warnings/errors
• New optimizer features causing query plan changes
• Monitor resource usage (iostat, top, vmstat etc)
• Upgrade connectors as well
• Backup/Restore processes are your best insurance
31
31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Upgrade – Recap
• Prepare your upgrade (release notes, resources)
• DO run the Upgrade Checker Utility
–Fix issues until it runs clean
• TEST your applications on MySQL 8.0
• DO your backup
• Upgrade to MySQL 8.0
• Enjoy! :)
32
32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Upgrade Resources
• https://dev.mysql.com/doc/refman/8.0/en/upgrading-strategies.html#upgrade-prerequisites
• https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html
• https://mysqlserverteam.com/inplace-upgrade-from-mysql-5-7-to-mysql-8-0/
• https://mysqlserverteam.com/upgrading-to-mysql-8-0-here-is-what-you-need-to-know/
• https://mysqlserverteam.com/mysql-shell-8-0-4-introducing-upgrade-checker-utility/
• https://mysqlserverteam.com/upgrading-to-mysql-8-0-with-spatial-data/
• https://mysqlserverteam.com/whats-new-in-mysql-8-0-generally-available/
• https://mysqlserverteam.com/upgrading-your-mysql-server-farm/
• https://mysqlserverteam.com/mysql-8-0-collations-migrating-from-older-collations/
• https://mysqlserverteam.com/new-defaults-in-mysql-8-0/
33
33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
MySQL Resources
34
• MySQL Server Team Blog
– http://mysqlserverteam.com/
• MySQL High Availability Blog
– http://mysqlhighavailability.com/
• MySQL Release Engineering Blog
– https://mysqlrelease.com/
• MySQL Dev Team Blog
– https://insidemysql.com/
• MySQL Enterprise Team Blogs
– https://blogs.oracle.com/mysql/
• Lefred’s blog
– https://jefred.be
• Jesper’s blog
– https://mysql.wisborg.dk
• Dimitri’s blog
– http://dimitrik.free.fr/blog/
• Andrew’s blog
– https://thesubtlepath.com/blog/
• Olivier Dasini’s blog
– http://dasini.net/blog/
34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Thank you!