暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

从鸟山明到 MySQL 5.7 EOL

原创 严少安 2024-05-16
395

鸟山明,这个名字代表着无限的想象力和创造力。他的《龙珠》不仅是一部漫画,更是一种文化现象。

今天,我们将从这部经典作品出发,讨论一个看似不相关的主题:MySQL 5.7的生命周期结束。

20240502_180027.png

鸟山明与《龙珠》

鸟山明,这个名字对于许多人来说,是童年的记忆,是英雄主义的象征。

他的作品《龙珠》不仅塑造了一个充满奇幻和冒险的世界,更激发了无数人对超越自我的渴望。

记得孙悟空与弗利萨的决战吗?那是一场关于力量、智慧和勇气的较量,也是一次关于不断突破极限的挑战。

nimg.ws.126.jpg

MySQL 5.7 EOL

现在,让我们从赛亚人的战斗场景转向数据库的世界。

MySQL,作为全球最受欢迎的开源数据库之一,它的每一次更新都牵动着无数开发者的心。

2023年,MySQL 5.7宣布了生命周期结束(EOL),这意味着官方不再提供安全更新和技术支持。

对于依赖这个版本的开发者来说,这无疑是一个重大的转折点。

MySQL 5.7 EOL 的影响

对于开发者来说,MySQL 5.7 EOL 不仅仅是一个结束,更是一个新的开始。

它意味着我们必须考虑迁移到新版本,但这也是一个提升系统性能和安全性的机会。

比如使用更新的硬件、 OS 系统,以及新版本的生态工具。

就像孙悟空不断突破自我极限一样,开发者也需要不断创新,不断学习,以适应技术的发展。

再见 MySQL 5.7,升级到 MySQL 8.0

或许是时候跟 MySQL 5.7 说再见了,下面使用 RPM 方式进行版本升级。

连接到数据库,并写入测试数据。

mysql> use yandb
Database changed
mysql> create table t (id int, c datetime);
Query OK, 0 rows affected (0.05 sec)

mysql> insert t select 1,now();
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

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 数据库。

mysql> select version()\G
*************************** 1. row ***************************
version(): 5.7.44
1 row in set (0.00 sec)

mysql> shutdown;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

下载 MySQL 8.0 安装包,注意选择对应操作系统。

比如,MySQL 5.7 安装在 CentOS 7 上,MySQL 8.0 的包需要选择 Red Hat Enterprise Linux 7。

解压并安装 RPM 包。

[root@centos7 tmp]# tar xf mysql-8.0.37-1.el7.x86_64.rpm-bundle.tar [root@centos7 tmp]# ll mysql* -rw-r--r-- 1 root root 1043773440 Mar 31 15:08 mysql-8.0.37-1.el7.x86_64.rpm-bundle.tar -rw-r--r-- 1 7155 31415 16768148 Mar 31 14:51 mysql-community-client-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 3621444 Mar 31 14:52 mysql-community-client-plugins-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 681816 Mar 31 14:52 mysql-community-common-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 538409072 Mar 31 14:53 mysql-community-debuginfo-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 1948516 Mar 31 14:53 mysql-community-devel-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 4218268 Mar 31 14:53 mysql-community-embedded-compat-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 2344724 Mar 31 14:53 mysql-community-icu-data-files-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 1564000 Mar 31 14:53 mysql-community-libs-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 685676 Mar 31 14:53 mysql-community-libs-compat-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 67951180 Mar 31 14:54 mysql-community-server-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 25689952 Mar 31 14:54 mysql-community-server-debug-8.0.37-1.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 379877568 Mar 31 14:56 mysql-community-test-8.0.37-1.el7.x86_64.rpm

使用 yum 命令进行更新安装。

[root@centos7 tmp]# yum install mysql-community-* Loaded plugins: fastestmirror, ovl Examining mysql-community-client-8.0.37-1.el7.x86_64.rpm: mysql-community-client-8.0.37-1.el7.x86_64 Marking mysql-community-client-8.0.37-1.el7.x86_64.rpm as an update to mysql-community-client-5.7.44-1.el7.x86_64 ... --> Finished Dependency Resolution ... Install 5 Packages (+12 Dependent packages) Upgrade 7 Packages (+ 3 Dependent packages) 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 Dependency Installed: keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-55.el7_9 libcom_err-devel.x86_64 0:1.42.9-19.el7 libkadm5.x86_64 0:1.15.1-55.el7_9 libselinux-devel.x86_64 0:2.5-15.el7 libsepol-devel.x86_64 0:2.5-10.el7 libverto-devel.x86_64 0:0.2.5-4.el7 openssl-devel.x86_64 1:1.0.2k-26.el7_9 pcre-devel.x86_64 0:8.32-17.el7 perl-Test-Harness.noarch 0:3.28-3.el7 perl-Test-Simple.noarch 0:0.98-243.el7 zlib-devel.x86_64 0:1.2.7-21.el7_9 Updated: mysql-community-client.x86_64 0:8.0.37-1.el7 mysql-community-common.x86_64 0:8.0.37-1.el7 mysql-community-devel.x86_64 0:8.0.37-1.el7 mysql-community-embedded-compat.x86_64 0:8.0.37-1.el7 mysql-community-libs.x86_64 0:8.0.37-1.el7 mysql-community-libs-compat.x86_64 0:8.0.37-1.el7 mysql-community-test.x86_64 0:8.0.37-1.el7 Dependency Updated: krb5-libs.x86_64 0:1.15.1-55.el7_9 openssl-libs.x86_64 1:1.0.2k-26.el7_9 zlib.x86_64 0:1.2.7-21.el7_9 Replaced: mysql-community-embedded.x86_64 0:5.7.44-1.el7 mysql-community-embedded-devel.x86_64 0:5.7.44-1.el7 Complete!

安装完成,启动 MySQL 8.0,并查看日志,可以看到日志中显示服务器从 50700 升级到了 80037。

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 的第一个 LTS 版本 8.4.0 发布,MySQL 9.0 创新版本也计划于三季度发版。

(关于 MySQL 8.4 的消息,请参考:快讯! MySQL 8.4.0 LTS 发布(MySQL 第一个长期支持版本)

值得注意的是,我们无法从 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)

对此,建议各位从业者关注 MySQL 8.4 的发版动态,包括新特性和兼容性方面的内容,

并考虑将现有的 MySQL 5.7 服务器择机升级到 8.0 版本,以应对未来的变化。

往期精彩

– END –

如果这篇文章为你带来了灵感或启发,就请帮忙点『赞』or『在看』or『转发』吧,感谢!(๑˃̵ᴗ˂̵)

最后修改时间:2024-05-20 11:18:18
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论