据外媒 Windows Central 报道,微软透露称,消费者和教育领域月活跃 Windows 10 设备数量同比呈现两位数增长,但官方没有公布具体的数字。纳德拉表示,在过去 9 个月全球疫情期间,Windows 和 PC 再次证明了自身的重要性,他认为包括远程学习、远程工作等多种活动,仍依赖于 PC 以及 PC 上所安装的软件去完成,微软将会把更多精力放在 Windows 系统开发上,并减少一些不必要的 Bug,以改善用户体验和口碑。
-
Upgrade from MySQL 5.7 to 8.0 is supported. However, upgrade is only supported between General Availability (GA) releases. For MySQL 8.0, it is required that you upgrade from a MySQL 5.7 GA release (5.7.9 or higher). Upgrades from non-GA releases of MySQL 5.7 are not supported.
-
Upgrading to the latest release is recommended before upgrading to the next version. For example, upgrade to the latest MySQL 5.7 release before upgrading to MySQL 8.0.
-
Upgrade that skips versions is not supported. For example, upgrading directly from MySQL 5.6 to 8.0 is not supported.
-
Once a release series reaches General Availability (GA) status, upgrade within the release series (from one GA version to another GA version) is supported. For example, upgrading from MySQL 8.0.
x
to 8.0.y
is supported. (Upgrade involving development-status non-GA releases is not supported.) Skipping a release is also supported. For example, upgrading from MySQL 8.0.x
to 8.0.z
is supported. MySQL 8.0.11 is the first GA status release within the MySQL 8.0 release series.
We are really excited about MySQL 8.0 new features (https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html) and our consultants spend several hours weekly, testing new features and doing research on how best we can create value for our customers from having those in production. Being an pure-play MySQL consulting, support and remote DBA services company, We are fully accountable for our customer database infrastructure operations performance, scalability, high availability and reliability. As we are aggressive about gaining maximum results from MySQL 8 investments made by our customers, We are equally conservative (our customer data reliability is critical for us !) on adopting new features, until we are fully confident after several rounds of testing (at different scales on multiple platforms) and technical review (we engage both internal and external consultants for acceptance) and acceptance before deployment in production infrastructure. In the previous versions of MySQL, before every upgrade our consultants manually spend several hours testing compatibility but MySQL 8 made this simple by introducing “upgrade checker” javascript with MySQL Shell 8.0.11 , In this blog we are writing about “upgrade checker” utility and upgrade from MySQL 5.7 to MySQL 8.0 .
Using MySQL Shell 8.0.11 “upgrade checker”
Typical “upgrade checker” run will look similar to this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
MySQL JS > util.checkForServerUpgrade("root@localhost:3306")
Please provide the password for 'root@localhost:3306': **********
The MySQL server at localhost:3306 will now be checked for compatibility issues for upgrade to MySQL 8.0...
MySQL version: 5.7.22-log - MySQL Community Server (GPL)
1) Usage of db objects with names conflicting with reserved keywords in 8.0
No issues found
2) Usage of utf8mb3 charset
Warning: The following objects use the utf8mb3 character set. It is recommended to convert them to use utf8mb4 instead, for improved Unicode support.
sakila.actor.first_name - column's default character set: utf8
sakila.actor.last_name - column's default character set: utf8
sakila.actor_info.first_name - column's default character set: utf8
sakila.actor_info.last_name - column's default character set: utf8
sakila.actor_info.film_info - column's default character set: utf8
sakila.address.address - column's default character set: utf8
sakila.address.address2 - column's default character set: utf8
sakila.address.district - column's default character set: utf8
sakila.address.postal_code - column's default character set: utf8
sakila.address.phone - column's default character set: utf8
sakila.category.name - column's default character set: utf8
sakila.city.city - column's default character set: utf8
sakila.country.country - column's default character set: utf8
sakila.customer.first_name - column's default character set: utf8
sakila.customer.last_name - column's default character set: utf8
sakila.customer.email - column's default character set: utf8
sakila.customer_list.name - column's default character set: utf8
sakila.customer_list.address - column's default character set: utf8
sakila.customer_list.zip code - column's default character set: utf8
sakila.customer_list.phone - column's default character set: utf8
sakila.customer_list.city - column's default character set: utf8
sakila.customer_list.country - column's default character set: utf8
sakila.customer_list.notes - column's default character set: utf8
sakila.film.title - column's default character set: utf8
sakila.film.description - column's default character set: utf8
sakila.film.rating - column's default character set: utf8
sakila.film.special_features - column's default character set: utf8
sakila.film_list.title - column's default character set: utf8
sakila.film_list.description - column's default character set: utf8
sakila.film_list.category - column's default character set: utf8
sakila.film_list.rating - column's default character set: utf8
sakila.film_list.actors - column's default character set: utf8
sakila.film_text.title - column's default character set: utf8
sakila.film_text.description - column's default character set: utf8
sakila.language.name - column's default character set: utf8
sakila.nicer_but_slower_film_list.title - column's default character set: utf8
sakila.nicer_but_slower_film_list.description - column's default character set: utf8
sakila.nicer_but_slower_film_list.category - column's default character set: utf8
sakila.nicer_but_slower_film_list.rating - column's default character set: utf8
sakila.nicer_but_slower_film_list.actors - column's default character set: utf8
sakila.sales_by_film_category.category - column's default character set: utf8
sakila.sales_by_store.store - column's default character set: utf8
sakila.sales_by_store.manager - column's default character set: utf8
sakila.staff.first_name - column's default character set: utf8
sakila.staff.last_name - column's default character set: utf8
sakila.staff.email - column's default character set: utf8
sakila.staff.username - column's default character set: utf8
sakila.staff.password - column's default character set: utf8
sakila.staff_list.name - column's default character set: utf8
sakila.staff_list.address - column's default character set: utf8
sakila.staff_list.zip code - column's default character set: utf8
sakila.staff_list.phone - column's default character set: utf8
sakila.staff_list.city - column's default character set: utf8
sakila.staff_list.country - column's default character set: utf8
3) Usage of use ZEROFILL/display length type attributes
Notice: The following table columns specify a ZEROFILL/display length attributes. Please be aware that they will be ignored in MySQL 8.0
sakila.customer.active - tinyint(1)
sakila.staff.active - tinyint(1)
4) Issues reported by 'check table x for upgrade' command
No issues found
5) Table names in the mysql schema conflicting with new tables in 8.0
No issues found
6) Usage of old temporal type
No issues found
7) Foreign key constraint names longer than 64 characters
No issues found
8) Usage of obsolete MAXDB sql_mode flag
No issues found
9) Usage of obsolete sql_mode flags
No issues found
10) Usage of partitioned tables in shared tablespaces
No issues found
11) Usage of removed functions
No issues found
No fatal errors were found that would prevent a MySQL 8 upgrade, but some potential issues were detected. Please ensure that the reported issues are not significant before upgrading.
1
|
At the end, “upgrade checker” prints a summary and returns an integer value describing he severity of the issues found:
- 0 – no issues or only ones categorized as notice,
- 1 – No fatal errors were found, but some potential issues were detected,
- 2 – UC found errors that must be fixed before upgrading to 8.0.
Upgrade from MySQL 5.7 to MySQL 8.0
Step 1 – Uninstall MySQL 5.7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# yum remove mysql-community-client.x86_64 mysql-community-common.x86_64 mysql-community-devel.x86_64 mysql-community-libs.x86_64 mysql-community-libs-compat.x86_64 mysql-community-server.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.22-1.el7 will be erased
---> Package mysql-community-common.x86_64 0:5.7.22-1.el7 will be erased
---> Package mysql-community-devel.x86_64 0:5.7.22-1.el7 will be erased
---> Package mysql-community-libs.x86_64 0:5.7.22-1.el7 will be erased
---> Package mysql-community-libs-compat.x86_64 0:5.7.22-1.el7 will be erased
---> Package mysql-community-server.x86_64 0:5.7.22-1.el7 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================
Package Arch Version Repository Size
=======================================================================================
Removing:
mysql-community-client x86_64 5.7.22-1.el7 @mysql57-community 106 M
mysql-community-common x86_64 5.7.22-1.el7 @mysql57-community 2.5 M
mysql-community-devel x86_64 5.7.22-1.el7 @mysql57-community 21 M
mysql-community-libs x86_64 5.7.22-1.el7 @mysql57-community 9.4 M
mysql-community-libs-compat x86_64 5.7.22-1.el7 @mysql57-community 9.2 M
mysql-community-server x86_64 5.7.22-1.el7 @mysql57-community 743 M
Transaction Summary
=======================================================================================
Remove 6 Packages
Installed size: 892 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : mysql-community-devel-5.7.22-1.el7.x86_64 1/6
Erasing : mysql-community-server-5.7.22-1.el7.x86_64 2/6
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
Erasing : mysql-community-client-5.7.22-1.el7.x86_64 3/6
Erasing : mysql-community-libs-compat-5.7.22-1.el7.x86_64 4/6
Erasing : mysql-community-libs-5.7.22-1.el7.x86_64 5/6
Erasing : mysql-community-common-5.7.22-1.el7.x86_64 6/6
Verifying : mysql-community-libs-compat-5.7.22-1.el7.x86_64 1/6
Verifying : mysql-community-common-5.7.22-1.el7.x86_64 2/6
Verifying : mysql-community-devel-5.7.22-1.el7.x86_64 3/6
Verifying : mysql-community-server-5.7.22-1.el7.x86_64 4/6
Verifying : mysql-community-client-5.7.22-1.el7.x86_64 5/6
Verifying : mysql-community-libs-5.7.22-1.el7.x86_64 6/6
Removed:
mysql-community-client.x86_64 0:5.7.22-1.el7
mysql-community-common.x86_64 0:5.7.22-1.el7
mysql-community-devel.x86_64 0:5.7.22-1.el7
mysql-community-libs.x86_64 0:5.7.22-1.el7
mysql-community-libs-compat.x86_64 0:5.7.22-1.el7
mysql-community-server.x86_64 0:5.7.22-1.el7
Complete!
[root@localhost ~]#
|
Step 2 – Install MySQL 8.0
1
2
3
4
5
6
7
8
9
10
11
|
[root@localhost MySQL8-Community-Edition]# rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm mysql-community-client-8.0.11-1.el7.x86_64.rpm mysql-community-common-8.0.11-1.el7.x86_64.rpm mysql-community-devel-8.0.11-1.el7.x86_64.rpm mysql-community-libs-8.0.11-1.el7.x86_64.rpm mysql-community-libs-compat-8.0.11-1.el7.x86_64.rpm
warning: mysql-community-server-8.0.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-8.0.11-1.e################################# [ 17%]
2:mysql-community-libs-8.0.11-1.el7################################# [ 33%]
3:mysql-community-client-8.0.11-1.e################################# [ 50%]
4:mysql-community-server-8.0.11-1.e################################# [ 67%]
5:mysql-community-devel-8.0.11-1.el################################# [ 83%]
6:mysql-community-libs-compat-8.0.1################################# [100%]
[root@localhost MySQL8-Community-Edition]#
|
Step 3- Start MySQL 8.0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@localhost MySQL8-Community-Edition]# systemctl start mysqld
[root@localhost MySQL8-Community-Edition]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.11 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
|
Step 4 – Run “mysql_upgrade” , mysql_upgrade checks for all tables in all databases for incompatibilities with the current version of MySQL Server, it also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
[root@localhost MySQL8-Community-Edition]# mysql_upgrade -u root -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Upgrading system table data.
Checking system database.
mysql.columns_priv OK
mysql.component OK
mysql.db OK
mysql.default_roles OK
mysql.engine_cost OK
mysql.func OK
mysql.general_log OK
mysql.global_grants OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.password_history OK
mysql.plugin OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.role_edges OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Found outdated sys schema version 1.5.1.
Upgrading the sys schema.
Checking databases.
employees.departments OK
employees.dept_emp OK
employees.dept_manager OK
employees.employees OK
employees.salaries OK
employees.tab1 OK
employees.titles OK
sakila.actor OK
sakila.address OK
sakila.category OK
sakila.city OK
sakila.country OK
sakila.customer OK
sakila.film OK
sakila.film_actor OK
sakila.film_category OK
sakila.film_text OK
sakila.inventory OK
sakila.language OK
sakila.payment OK
sakila.rental OK
sakila.staff OK
sakila.store OK
sys.sys_config OK
Upgrade process completed successfully.
Checking if update is needed.
|
Success ?? , You have successfully completed upgrade from MySQL 5.7 to MySQL 8.0 .
MySQL 8 uses a global data dictionary
containing information about database objects in transactional tables. In previous versions, the dictionary data was stored in metadata files and non-transactional system tables. You need to upgrade your data directory
from the file-based structure to the data-dictionary structure.
Just like a downgrade, you can upgrade using two methods:
- In-place upgrade
- Logical upgrade
You also should check a few prerequisites before the upgrade.
- Check for obsolete datatypes or triggers that have a missing or empty definer or an invalid creation context:
shell> sudo mysqlcheck -u root -p --all-databases --check-upgrade
- There must be no partitioned tables that use a storage engine that does not have native partitioning support. To identify these tables, execute this query:
shell> SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE NOT IN ('innodb', 'ndbcluster') AND CREATE_OPTIONS LIKE '%partitioned%';
If there are any of these tables, change them to InnoDB
:
mysql> ALTER TABLE table_name ENGINE = INNODB;
Or remove the partitioning:
mysql> ALTER TABLE table_name REMOVE PARTITIONING;
- There must be no tables in the MySQL 5.7
mysql
system database that have the same name as a table used by the MySQL 8.0data dictionary
. To identify tables with those names, execute this query:
mysql> SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE LOWER(TABLE_SCHEMA) = 'mysql' and LOWER(TABLE_NAME) IN ('catalogs', 'character_sets', 'collations', 'column_type_elements', 'columns', 'events', 'foreign_key_column_usage', 'foreign_keys', 'index_column_usage', 'index_partitions', 'index_stats', 'indexes', 'parameter_type_elements', 'parameters', 'routines', 'schemata', 'st_spatial_reference_systems', 'table_partition_values', 'table_partitions', 'table_stats', 'tables', 'tablespace_files', 'tablespaces', 'triggers', 'version', 'view_routine_usage', 'view_table_usage');
- There must be no tables that have foreign key constraint names longer than 64 characters. To identify tables with constraint names that are too long, execute this query:
mysql> SELECT CONSTRAINT_SCHEMA, TABLE_NAME, CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE LENGTH(CONSTRAINT_NAME) > 64;
- Tables not supported by MySQL 8.0, such as
ndb
, should be moved toInnoDB
:
mysql> ALTER TABLE tablename ENGINE=InnoDB;
Just like the previous recipe, the following subsections will take you through the details with various systems, bundles, and so on.
Here is an outline of the steps:
- Shut down the old MySQL version.
- Replace the old MySQL binaries or packages with the new ones (detailed steps for different types of installation methods are covered).
- Restart MySQL on the existing
data directory
. - Run the
mysql_upgrade
utility. - In the MySQL 5.7 server, if there are encrypted
InnoDB
tablespaces, rotate thekeyring
master key by executing this statement:
mysql> ALTER INSTANCE ROTATE INNODB MASTER KEY;
Here are the detailed steps:
- Configure your MySQL 5.7 server to perform a slow shutdown. With a slow shutdown,
InnoDB
performs a full purge and change buffer merge before shutting down, which ensures that the undo logs are empty and the data files are fully prepared in case of file format differences between releases. This step is the most important because, without it, you will end up with the following error:
[ERROR] InnoDB: Upgrade after a crash is not supported.
This redo log was created with MySQL 5.7.18. Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/upgrading.html:
mysql> SET GLOBAL innodb_fast_shutdown = 0;
- Shut down the MySQL server as described in the Starting or Stopping MySQL 8 section.
Upgrade the MySQL binaries or packages.
shell> sudo yum-config-manager --disable mysql57-community
shell> sudo yum-config-manager --enable mysql80-community
- Verify that
mysql80-community
is enabled:
shell> sudo yum repolist all | grep mysql8
mysql80-community/x86_64 MySQL 8.0 Community Server enabled: 16
mysql80-community-source MySQL 8.0 Community Server disabled
- Run the yum update:
shell> sudo yum update mysql-server
shell> sudo dpkg-reconfigure mysql-apt-config
- Run
apt-get update
:
shell> sudo apt-get update
- Remove the current version:
shell> sudo apt-get remove mysql-community-server mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-server mysql-community-server-core -y
shell> sudo apt-get autoremove
- Install MySQL 8:
shell> sudo apt-get update
shell> sudo apt-get install mysql-server
shell> sudo apt-get install libmysqlclient21
Uninstall the existing packages (refer to the Uninstalling MySQL 8 section) and install the new packages, which can be downloaded fromMySQL Downloads
(refer to the Installing MySQL 8.0 using RPM or DEB files section).
If you have installed MySQL through binaries, you have to remove the symlink to the old version (refer to the Uninstalling MySQL 8 section) and do a fresh installation (refer to the Installing MySQL on Linux using generic binaries section).
Start the MySQL 8.0 server (refer to the Starting or Stopping MySQL 8 to start MySQL section). If there are encrypted InnoDB
tablespaces, use the --early-plugin-load
option to load the keyring
plugin.
The server automatically detects whether data dictionary
tables are present. If not, the server creates them in the data directory
, populates them with metadata, and then proceeds with its normal startup sequence. During this process, the server upgrades metadata for all database objects, including databases, tablespaces, system and user tables, views, and stored programs (stored procedures and functions, triggers, event scheduler events). The server also removes files that previously were used for metadata storage. For example, after upgrading, you will notice that your tables no longer have .frm
files.
The server creates a directory named backup_metadata_57
and moves the files used by MySQL 5.7 into it. The server renames the event
and proc
tables to event_backup_57
and proc_backup_57
. If this upgrade fails, the server reverts all changes to the data directory
. In this case, you should remove all redo log files, start your MySQL 5.7 server on the same data directory
, and fix the cause of any errors. Then, perform another slow shutdown of the 5.7 server and start the MySQL 8.0 server to try again.
Run the mysql_upgrade
utility:
shell> sudo mysql_upgrade -u root -p
mysql_upgrade
examines all tables in all databases for incompatibilities with the current version of MySQL. It makes any remaining changes required in the mysql
system database between MySQL 5.7 and MySQL 8.0, so that you can take advantage of new privileges or capabilities. mysql_upgrade
also brings the performance schema, INFORMATION_SCHEMA
, and sys schema
objects up to date for MySQL 8.0.
Restart the MySQL server (refer to the Starting or Stopping MySQL 8 to start MySQL section).
Here is an outline of the steps:
- Export existing data from the old MySQL version using
mysqldump
- Install the new MySQL version
- Load the dump file into the new MySQL version
- Run the
mysql_upgrade
utility
Here are the detailed steps:
- You need to take a logical backup of the database (refer to Chapter 7, Backups for a quicker backup called
mydumper
):
shell> mysqldump -u root -p --add-drop-table --routines --events --all-databases --ignore-table=mysql.innodb_table_stats --ignore-table=mysql.innodb_index_stats --force > data-for-upgrade.sql
- Shut down the MySQL server (refer to the Starting or Stopping MySQL 8 section).
- Install the new MySQL version (refer to the methods mentioned in the In-place upgrades section).
- Start the MySQL server (refer to the Starting or Stopping MySQL 8 section).
- Reset the temporary
root
password:
shell> mysql -u root -p
Enter password: **** (enter temporary root password from error log)
mysql> ALTER USER USER() IDENTIFIED BY 'your new password';
- Restore the backup (this may take a long time depending up on the size of the backup). Refer to Chapter 8, Restoring Data for a quick restoration method called
myloader
:
shell> mysql -u root -p --force < data-for-upgrade.sql
- Run the
mysql_upgrade
utility:
shell> sudo mysql_upgrade -u root -p
- Restart the MySQL server (refer to the Starting or Stopping MySQL 8 section).