安装
-
下载检查工具
https://dev.mysql.com/downloads/shell/
选择所需要的系统版本
-
检查工具安装
rpm -ivh mysql-shell-8.0.33-1.el7.x86_64.rpm
-
检查mysqlsh版本,确定指向无误
mysqlsh --version
升级检查
进行升级检查,使用如下命令
mysqlsh -- util checkForServerUpgrade root@localhost:3306 --target-version=8.0.32 --config-path=/etc/my.cnf
Please provide the password for 'root@localhost:3306': *******
Save password for 'root@localhost:3306'? [Y]es/[N]o/Ne[v]er (default No):
The MySQL server at localhost:3306, version 5.7.41-log - MySQL Community Server
(GPL), will now be checked for compatibility issues for upgrade to MySQL
8.0.32...
或
[root@itdev2 ~]# mysqlsh -uroot -p
Please provide the password for 'root@localhost': *******
Save password for 'root@localhost'? [Y]es/[N]o/Ne[v]er (default No):
MySQL Shell 8.0.33
Copyright (c) 2016, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
Creating a session to 'root@localhost'
Fetching schema names for auto-completion... Press ^C to stop.
Your MySQL connection id is 2885
Server version: 5.7.41-log MySQL Community Server (GPL)
No default schema selected; type \use to set one.
MySQL localhost:3306 JS > util.checkForServerUpgrade('root@localhost:3306', {"password":"root123","targetVersion":"8.0.32","configPath":"/etc/my.cnf"})
显示如下日志
1) Usage of old temporal type
No issues found
2) MySQL 8.0 syntax check for routine-like objects
No issues found
... ...
Errors: 5
Warnings: 31313
Notices: 1649
一共检查如下 27 项
- Usage of old temporal type
- MySQL 8.0 syntax check for routine-like objects
- Usage of db objects with names conflicting with new reserved keywords
- Usage of utf8mb3 charset
- Table names in the mysql schema conflicting with new tables in 8.0
- Partitioned tables using engines with non native partitioning
- Foreign key constraint names longer than 64 characters
- Usage of obsolete MAXDB sql_mode flag
- Usage of obsolete sql_mode flags
- ENUM/SET column definitions containing elements longer than 255 characters
- Usage of partitioned tables in shared tablespaces
- Circular directory references in tablespace data file paths
- Usage of removed functions
- Usage of removed GROUP BY ASC/DESC syntax
- Removed system variables for error logging to the system log configuration
- Removed system variables
- System variables with new default values
- Zero Date, Datetime, and Timestamp values
- Schema inconsistencies resulting from file removal or corruption
- Tables recognized by InnoDB that belong to a different engine
- Issues reported by ‘check table x for upgrade’ command
- New default authentication plugin considerations
- Columns which cannot have default values
- Check for invalid table names and schema names used in 5.7
- Check for orphaned routines in 5.7
- Check for deprecated usage of single dollar signs in object names
- Check for indexes that are too large to work on higher versions of MySQL
我这套数据库需要解决五处错误,才可以升级,所以从稳定性考虑,先不做升级处理
升级检查帮助
[root@itdev2 ~]# mysqlsh -uroot -p
Please provide the password for 'root@localhost': *******
Save password for 'root@localhost'? [Y]es/[N]o/Ne[v]er (default No):
MySQL Shell 8.0.33
Copyright (c) 2016, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
Creating a session to 'root@localhost'
Fetching schema names for auto-completion... Press ^C to stop.
Your MySQL connection id is 2895
Server version: 5.7.41-log MySQL Community Server (GPL)
No default schema selected; type \use to set one.
MySQL localhost:3306 JS > util.help("checkForServerUpgrade")
NAME
checkForServerUpgrade - Performs series of tests on specified MySQL
server to check if the upgrade process will
succeed.
SYNTAX
util.checkForServerUpgrade([connectionData][, options])
WHERE
connectionData: The connection data to server to be checked
options: Dictionary of options to modify tool behaviour.
DESCRIPTION
If no connectionData is specified tool will try to establish connection
using data from current session.
Tool behaviour can be modified with following options:
- configPath - full path to MySQL server configuration file.
- outputFormat - value can be either TEXT (default) or JSON.
- targetVersion - version to which upgrade will be checked
(default=8.0.33)
- password - password for connection.
The connection data may be specified in the following formats:
- A URI string
- A dictionary with the connection options
A basic URI string has the following format:
[scheme://][user[:password]@][/schema][?option=value&option=value...]
Connection Options
The following options are valid for use either in a URI or in a
dictionary:
- ssl-mode: The SSL mode to be used in the connection.
- ssl-ca: The path to the X509 certificate authority file in PEM format.
- ssl-capath: The path to the directory that contains the X509
certificate authority files in PEM format.
- ssl-cert: The path to the SSL public key certificate file in PEM
format.
- ssl-key: The path to the SSL private key file in PEM format.
- ssl-crl: The path to file that contains certificate revocation lists.
- ssl-crlpath: The path of directory that contains certificate revocation
list files.
- ssl-cipher: The list of permissible encryption ciphers for connections
that use TLS protocols up through TLSv1.2.
- tls-version: List of protocols permitted for secure connections.
- tls-ciphers: List of TLS v1.3 ciphers to use.
- auth-method: Authentication method.
- get-server-public-key: Request public key from the server required for
RSA key pair-based password exchange. Use when connecting to MySQL 8.0
servers with classic MySQL sessions with SSL mode DISABLED.
- server-public-key-path: The path name to a file containing a
client-side copy of the public key required by the server for RSA key
pair-based password exchange. Use when connecting to MySQL 8.0 servers
with classic MySQL sessions with SSL mode DISABLED.
- connect-timeout: The connection timeout in milliseconds. If not
provided a default timeout of 10 seconds will be used. Specifying a
value of 0 disables the connection timeout.
- compression: Enable compression in client/server protocol.
- compression-algorithms: Use compression algorithm in server/client
protocol.
- compression-level: Use this compression level in the client/server
protocol.
- connection-attributes: List of connection attributes to be registered
at the PERFORMANCE_SCHEMA connection attributes tables.
- local-infile: Enable/disable LOAD DATA LOCAL INFILE.
- net-buffer-length: The buffer size for TCP/IP and socket communication.
When these options are defined in a URI, their values must be URL
encoded.
The following options are also valid when a dictionary is used:
Base Connection Options
- uri: a URI string.
- scheme: the protocol to be used on the connection.
- user: the MySQL user name to be used on the connection.
- dbUser: alias for user.
- password: the password to be used on the connection.
- dbPassword: same as password.
- host: the hostname or IP address to be used on the connection.
- port: the port to be used in a TCP connection.
- socket: the socket file name to be used on a connection through unix
sockets.
- schema: the schema to be selected once the connection is done.
SSH Tunnel Connection Options
- ssh: a SSHURI string used when SSH tunnel is required.
- ssh-password: the password the be used on the SSH connection.
- ssh-identity-file: the key file to be used on the SSH connection.
- ssh-identity-file-password: the SSH key file password.
- ssh-config-file: the SSH configuration file, default is the value of
shell.options['ssh.configFile']
ATTENTION: The dbUser and dbPassword options are will be removed in a
future release.
ATTENTION: The connection options have precedence over options specified
in the connection options uri
The connection options are case insensitive and can only be defined once.
If an option is defined more than once, an error will be generated.
For additional information on connection data use \? connection.
MySQL localhost:3306 JS >