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

新奇的 MYSQL 8.4.0

原创 ByteHouse 2024-05-06
700

MySQL的第一个长期支持版 8.4 GA 。

1.MySQL数据库版本

版本 说明
社区版:
MySQL Community Edition (GPL)
1.企业版的“体验版",未经各个专有系统平台的压力和性能测试
2.基于GPL协议发布,可以随意下载使用
3.没有官方技术支持服务
企业版:
MySQL Enterprise Edition(commercial)
1.提供了比较全面的高级功能、管理工具及技术支持
2.安全性、稳定性、可扩展性比较好
集群版:
MySQL Cluster CGE(commercial)
社区版可使用集群;企业版可使用集群

2.版本命名方式

版本 说明
a (Alpha) 版 内测版,内部交流或者专业测试人员测试用。Bug较多,普通用户最好不要安装。
β(Beta) 版 公测版,专业爱好者大规模测试用,存在一些缺陷,该版本也不适合一般用户安装。
y(Gamma )版 相当成熟的测试版,与即将发行的正式版相差无几。
y(Gamma )版 相当成熟的测试版,与即将发行的正式版相差无几。
Final 正式版本
Free 自由版本
Release 发行版本
Standard 标准版本
Mini 迷你精简版本,只有最基本的功能
Upgrade 升级版本
GA(GenerallyAvailable) 开发团队认为该版本是稳定版,可以在较为关键的场合使用。
Retail 零售版

3.MySQL安装

安装方式 优点 缺点 命名:
rpm安装 卸载简单 可定制性差 RPM版本 :
MySQL-server-5.6.31-1.el7.x86_64.rpm,需要在特定linux版本下安装。
基于glibc安装 可定制性相比rpm包灵活些 安装相比rpm包复杂些,需要手动初始化数据库 基于glibc版本
命名:mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz
依赖 glibc库,可以安装在通用的Linux系统下
源代码编译安装 可定制性最强,根据需求和功能定制 安装麻烦,需要手动初始化数据库 源代码编译安装
命名:mysql-5.6.35.tar.gz,通用的Linux下都可以编译安装。

4.安装

step 1.解压安装包

mysql-8.4.0-1.el9.x86_64.rpm-bundle.tar

查看安装文件

[root@mysql-8 ~]# ll total 1677124 -rw-------. 1 root root 833 Aug 15 2023 anaconda-ks.cfg -rw-r--r--. 1 root root 858675200 May 6 08:42 mysql-8.4.0-1.el9.x86_64.rpm-bundle.tar -rw-r--r--. 1 7155 31415 3202706 Apr 11 03:20 mysql-community-client-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 19866647 Apr 11 03:20 mysql-community-client-debuginfo-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 1498324 Apr 11 03:20 mysql-community-client-plugins-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 2380658 Apr 11 03:20 mysql-community-client-plugins-debuginfo-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 590213 Apr 11 03:20 mysql-community-common-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 6079847 Apr 11 03:21 mysql-community-debuginfo-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 22140332 Apr 11 03:21 mysql-community-debugsource-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 7810937 Apr 11 03:21 mysql-community-devel-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 2383190 Apr 11 03:21 mysql-community-icu-data-files-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 1546205 Apr 11 03:21 mysql-community-libs-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 2281831 Apr 11 03:21 mysql-community-libs-debuginfo-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 52304326 Apr 11 03:22 mysql-community-server-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 24792626 Apr 11 03:22 mysql-community-server-debug-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 159357306 Apr 11 03:22 mysql-community-server-debug-debuginfo-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 193483715 Apr 11 03:22 mysql-community-server-debuginfo-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 337326151 Apr 11 03:23 mysql-community-test-8.4.0-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 21610974 Apr 11 03:23 mysql-community-test-debuginfo-8.4.0-1.el9.x86_64.rpm [root@mysql-8 ~]#

step 2.执行安装

dnf install -y mysql-community-server-8.4.0-1.el9.x86_64.rpm \ mysql-community-client-8.4.0-1.el9.x86_64.rpm \ mysql-community-client-plugins-8.4.0-1.el9.x86_64.rpm \ mysql-community-common-8.4.0-1.el9.x86_64.rpm \ mysql-community-icu-data-files-8.4.0-1.el9.x86_64.rpm \ mysql-community-libs-8.4.0-1.el9.x86_64.rpm

step 3.初始化数据库

systemctl start mysqld

查看日志

2024-05-06T00:53:05.534359Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-05-06T00:53:05.541842Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.0) initializing of server in progress as process 12365
2024-05-06T00:53:05.672593Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-05-06T00:53:16.708141Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-05-06T00:54:59.209151Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8AU)rX)q<rjw
2024-05-06T00:56:20.585054Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.
2024-05-06T00:56:20.673582Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-05-06T00:56:21.300916Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.0) starting as process 12460
2024-05-06T00:56:21.352149Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-05-06T00:56:30.702014Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-05-06T00:56:35.663976Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-05-06T00:56:35.664097Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-05-06T00:56:35.838619Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.0'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.
2024-05-06T00:56:36.116483Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock

启动过程中,执行了了初始化的命令

[root@mysql-8 log]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: activating (start-pre) since Mon 2024-05-06 08:53:05 CST; 2min 49s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Cntrl PID: 12339 (mysqld_pre_syst) Tasks: 30 (limit: 48928) Memory: 204.2M CPU: 6.880s CGroup: /system.slice/mysqld.service ├─12339 /usr/bin/bash /usr/bin/mysqld_pre_systemd └─12365 /usr/sbin/mysqld --initialize --datadir=/var/lib/mysql --user=mysql --init-file=/var/lib/mysql-files/install-validate-password-plugin.ecNGmr.sql May 06 08:53:05 mysql-8.4 systemd[1]: Starting MyL Server. [root@mysql-8 log]#

启动完成后

[root@mysql-8 log]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2024-05-06 08:56:35 CST; 17s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 12339 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 12460 (mysqld) Status: "Server is operational" Tasks: 36 (limit: 48928) Memory: 443.2M CPU: 10.314s CGroup: /system.slice/mysqld.service └─12460 /usr/sbin/mysqld May 06 08:53:05 mysql-8.4 systemd[1]: Starting MySQL Server... May 06 08:56:35 mysql-8.4 systemd[1]: Started MySQL Server. [root@mysql-8 log]#

5.mysql_secure_installation

mysql 5.6.X 版本

安装完 mysql-server 会提示可以运行mysql_secure_installation
运行 mysql_secure_installation 会执行几个设置:

  1. 为root用户设置密码

  2. 删除匿名账号

  3. 取消root用户远程登录

  4. 删除test库和对test库的访问权限

  5. 刷新授权表使修改生效

通过这几项的设置能够提高mysql库的安全。建议生产环境中mysql安装这完成后一定要运行一次mysql_secure_installation

user@user-2288H-V5:~/mysql-5.6.51-linux-glibc2.12-x86_64/scripts$ sudo ./mysql_install_db --user=user --defaults-file=/etc/my.cnf --basedir=/home/user/mysql-5.6.51-linux-glibc2.12-x86_64/ --datadir=/home/user/data/mysql --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp Installing MySQL system tables...2023-12-12 09:14:04 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2023-12-12 09:14:04 0 [Note] /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//bin/mysqld (mysqld 5.6.51) starting as process 3224 ... 2023-12-12 09:14:04 3224 [Note] InnoDB: Using atomics to ref count buffer pool pages 2023-12-12 09:14:04 3224 [Note] InnoDB: The InnoDB memory heap is disabled 2023-12-12 09:14:04 3224 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2023-12-12 09:14:04 3224 [Note] InnoDB: Memory barrier is not used 2023-12-12 09:14:04 3224 [Note] InnoDB: Compressed tables use zlib 1.2.11 2023-12-12 09:14:04 3224 [Note] InnoDB: Using Linux native AIO 2023-12-12 09:14:04 3224 [Note] InnoDB: Using CPU crc32 instructions 2023-12-12 09:14:04 3224 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2023-12-12 09:14:04 3224 [Note] InnoDB: Completed initialization of buffer pool 2023-12-12 09:14:04 3224 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2023-12-12 09:14:04 3224 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2023-12-12 09:14:04 3224 [Note] InnoDB: Database physically writes the file full: wait... 2023-12-12 09:14:04 3224 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2023-12-12 09:14:04 3224 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2023-12-12 09:14:04 3224 [Note] InnoDB: Data file ./undo001 did not exist: new to be created 2023-12-12 09:14:04 3224 [Note] InnoDB: Setting file ./undo001 size to 10 MB 2023-12-12 09:14:04 3224 [Note] InnoDB: Database physically writes the file full: wait... 2023-12-12 09:14:05 3224 [Note] InnoDB: Data file ./undo002 did not exist: new to be created 2023-12-12 09:14:05 3224 [Note] InnoDB: Setting file ./undo002 size to 10 MB 2023-12-12 09:14:05 3224 [Note] InnoDB: Database physically writes the file full: wait... 2023-12-12 09:14:05 3224 [Note] InnoDB: Data file ./undo003 did not exist: new to be created 2023-12-12 09:14:05 3224 [Note] InnoDB: Setting file ./undo003 size to 10 MB 2023-12-12 09:14:05 3224 [Note] InnoDB: Database physically writes the file full: wait... 2023-12-12 09:14:05 3224 [Note] InnoDB: Opened 3 undo tablespaces 2023-12-12 09:14:05 3224 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2023-12-12 09:14:05 3224 [Warning] InnoDB: New log files created, LSN=48424 2023-12-12 09:14:05 3224 [Note] InnoDB: Doublewrite buffer not found: creating new 2023-12-12 09:14:05 3224 [Note] InnoDB: Doublewrite buffer created 2023-12-12 09:14:05 3224 [Note] InnoDB: 128 rollback segment(s) are active. 2023-12-12 09:14:05 3224 [Warning] InnoDB: Creating foreign key constraint system tables. 2023-12-12 09:14:05 3224 [Note] InnoDB: Foreign key constraint system tables created 2023-12-12 09:14:05 3224 [Note] InnoDB: Creating tablespace and datafile system tables. 2023-12-12 09:14:05 3224 [Note] InnoDB: Tablespace and datafile system tables created. 2023-12-12 09:14:05 3224 [Note] InnoDB: Waiting for purge to start 2023-12-12 09:14:05 3224 [Note] InnoDB: 5.6.51 started; log sequence number 0 2023-12-12 09:14:05 3224 [Note] RSA private key file not found: /home/user/data/mysql//private_key.pem. Some authentication plugins will not work. 2023-12-12 09:14:05 3224 [Note] RSA public key file not found: /home/user/data/mysql//public_key.pem. Some authentication plugins will not work. 2023-12-12 09:14:06 3224 [Note] Binlog end 2023-12-12 09:14:06 3224 [Note] InnoDB: FTS optimize thread exiting. 2023-12-12 09:14:06 3224 [Note] InnoDB: Starting shutdown... 2023-12-12 09:14:08 3224 [Note] InnoDB: Shutdown completed; log sequence number 1508991 OK Filling help tables...2023-12-12 09:14:08 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2023-12-12 09:14:08 0 [Note] /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//bin/mysqld (mysqld 5.6.51) starting as process 3247 ... 2023-12-12 09:14:08 3247 [Note] InnoDB: Using atomics to ref count buffer pool pages 2023-12-12 09:14:08 3247 [Note] InnoDB: The InnoDB memory heap is disabled 2023-12-12 09:14:08 3247 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2023-12-12 09:14:08 3247 [Note] InnoDB: Memory barrier is not used 2023-12-12 09:14:08 3247 [Note] InnoDB: Compressed tables use zlib 1.2.11 2023-12-12 09:14:08 3247 [Note] InnoDB: Using Linux native AIO 2023-12-12 09:14:08 3247 [Note] InnoDB: Using CPU crc32 instructions 2023-12-12 09:14:08 3247 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2023-12-12 09:14:08 3247 [Note] InnoDB: Completed initialization of buffer pool 2023-12-12 09:14:08 3247 [Note] InnoDB: Opened 3 undo tablespaces 2023-12-12 09:14:08 3247 [Note] InnoDB: Highest supported file format is Barracuda. 2023-12-12 09:14:08 3247 [Note] InnoDB: 128 rollback segment(s) are active. 2023-12-12 09:14:08 3247 [Note] InnoDB: Waiting for purge to start 2023-12-12 09:14:08 3247 [Note] InnoDB: 5.6.51 started; log sequence number 1508991 2023-12-12 09:14:08 3247 [Note] RSA private key file not found: /home/user/data/mysql//private_key.pem. Some authentication plugins will not work. 2023-12-12 09:14:08 3247 [Note] RSA public key file not found: /home/user/data/mysql//public_key.pem. Some authentication plugins will not work. 2023-12-12 09:14:08 3247 [Note] Binlog end 2023-12-12 09:14:08 3247 [Note] InnoDB: FTS optimize thread exiting. 2023-12-12 09:14:08 3247 [Note] InnoDB: Starting shutdown... 2023-12-12 09:14:10 3247 [Note] InnoDB: Shutdown completed; log sequence number 1509001 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//bin/mysqladmin -u root password 'new-password' /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//bin/mysqladmin -u root -h user-2288H-V5 password 'new-password' Alternatively you can run: /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com WARNING: Found existing config file /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//my.cnf on the system. Because this file might be in use, it was not replaced, but was used in bootstrap (unless you used --defaults-file) and when you later start the server. The new default config file was created as /home/user/mysql-5.6.51-linux-glibc2.12-x86_64//my-new.cnf, please compare it with your file and take the changes you need. WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server user@user-2288H-V5:~/mysql-5.6.51-linux-glibc2.12-x86_64/scripts$

mysql 8.4.0 版本

安装完数据库后,没有相关的提示。

[root@mysql-8 ~]# systemctl start mysqld [root@mysql-8 ~]# [root@mysql-8 ~]# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: Error: Access denied for user 'root'@'localhost' (using password: NO)

启动数据库,使用 mysql_secure_installation ,提示需要使用 root 用户的密码。

连接MYSQL 数据库后,查看数据库信息,提示需要修改 root 密码后才能进行其他操作

[root@mysql-8 ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.4.0 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> status ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> mysql> alter user 'root'@'localhost' identified by 'Admin@123!'; Query OK, 0 rows affected (0.32 sec) mysql> status; -------------- mysql Ver 8.4.0 for Linux on x86_64 (MySQL Community Server - GPL) Connection id: 12 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.4.0 Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/lib/mysql/mysql.sock Binary data as: Hexadecimal Uptime: 9 min 38 sec Threads: 2 Questions: 10 Slow queries: 0 Opens: 147 Flush tables: 3 Open tables: 63 Queries per second avg: 0.017 -------------- mysql>

其他关于MYSQL 8.4.0的相关变化,在日后的使用中获取。

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

评论