mysql> table t; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table t' at line 1 mysql> select * from t; +------+---------------------+ | id | c | +------+---------------------+ | 1 | 2024-05-19 02:49:50 | +------+---------------------+ 1 row in set (0.00 sec)
关停 MySQL 5.7 数据库。
1 2 3 4 5 6 7 8 9 10
mysql> select version()\G *************************** 1. row *************************** version(): 5.7.44 1 row in set (0.00 sec)
Total size: 3.8 G Total download size: 5.3 M Is this ok [y/d/N]: y ... Installed: mysql-community-client-plugins.x86_64 0:8.0.37-1.el7 mysql-community-debuginfo.x86_64 0:8.0.37-1.el7 mysql-community-icu-data-files.x86_64 0:8.0.37-1.el7 mysql-community-server.x86_64 0:8.0.37-1.el7 mysql-community-server-debug.x86_64 0:8.0.37-1.el7
安装完成,启动 MySQL 8.0,并查看日志,可以看到日志中显示服务器从 50700 升级到了 80037。
1 2 3 4 5 6 7 8 9 10 11 12
2024-05-19T03:04:32.795807Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.37) starting as process 413 2024-05-19T03:04:32.858517Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory. 2024-05-19T03:04:32.858553Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-05-19T03:04:34.031931Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-05-19T03:04:38.591175Z 2 [System] [MY-011003] [Server] Finished populating Data Dictionary tables with data. 2024-05-19T03:04:42.545037Z 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80037' started. 2024-05-19T03:04:59.533585Z 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80037' completed. 2024-05-19T03:04:59.726578Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2024-05-19T03:04:59.726642Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2024-05-19T03:04:59.731768Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run' in the path is accessible to all OS users. Consider choosing a different directory. 2024-05-19T03:04:59.751314Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock 2024-05-19T03:04:59.751362Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.37' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
[mysql@centos7 ~]$ mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 8.0.37 MySQL Community Server - GPL
Copyright (c) 2000, 2024, 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 '\h' for help. Type '\c' to clear the current input statement.
mysql> select version()\G *************************** 1. row *************************** version(): 8.0.37 1 row in set (0.00 sec)
mysql> table yandb.t\G *************************** 1. row *************************** id: 1 c: 2024-05-19 02:49:50 1 row in set (0.00 sec)
值得注意的是,我们无法从 MySQL 5.7 直接升级到 MySQL 8.4,必须要先升级到 8.0。
Important Change: Upgrading from MySQL 5.7 to MySQL 8.4 is not supported; the code and behavior was updated to reflect this. Upgrade MySQL 5.7 to 8.0 before proceeding to 8.4. (WL #15924)