【MySQL】MySQL 8.4.0 长期支持版(LTS)安装

devtools/2024/10/21 9:38:51/

        就在2024年 “5.1” 节前,MySQL官方发布了8.4.0长期支持版(LTS - Long Term Support)。根据官方提供的文档,在本地虚拟机进行安装测试。

        安装、配置和启动过程记录如下:

        第一步,上传到安装包(mysql-commercial-8.4.0-linux-glibc2.17-x86_64.tar.xz)到虚拟机,并解压。

[root@vm-3rd89n7dd ~]# rz
rz waiting to receive.
Starting zmodem transfer.  Press Ctrl+C to cancel.
Transferring mysql-commercial-8.4.0-linux-glibc2.17-x86_64.tar.xz...100%  518611 KB    27295 KB/sec    00:00:19       0 Errors  
[root@vm-3rd89n7dd ~]# tar -xf mysql-commercial-8.4.0-linux-glibc2.17-x86_64.tar.xz
[root@vm-3rd89n7dd ~]# mv mysql-commercial-8.4.0-linux-glibc2.17-x86_64 /usr/local/mysql

        第二步,创建mysql用户和组,并给相关目录授权。

[root@vm-3rd89n7dd ~]# groupadd mysql
[root@vm-3rd89n7dd ~]# useradd -r -g mysql -s /bin/false mysql
[root@vm-3rd89n7dd ~]# cd /usr/local/mysql
[root@vm-3rd89n7dd mysql]# mkdir mysql-files
[root@vm-3rd89n7dd mysql]# chown mysql:mysql mysql-files
[root@vm-3rd89n7dd mysql]# chmod 750 mysql-files

        第三步,用户密码初始化(注意下面信息打印出来 temporary password ,登录数据库操作时,会提示必须修改

[root@vm-3rd89n7dd mysql]# bin/mysqld --initialize --user=mysql
2024-05-07T06:22:58.045209Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2024-05-07T06:22:58.047263Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.4.0-commercial) initializing of server in progress as process 3904
2024-05-07T06:22:58.064126Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-05-07T06:22:59.175074Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-05-07T06:23:01.261487Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: jgR;k1H4Wa!f
2024-05-07T06:23:04.365176Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.

        第四步,将mysql.server添加为系统服务,并启动mysql服务

[root@vm-3rd89n7dd mysql]# cp support-files/mysql.server /etc/init.d/mysql.server
[root@vm-3rd89n7dd mysql]# chkconfig --add mysql.server
[root@vm-3rd89n7dd mysql]# systemctl start mysql.server
[root@vm-3rd89n7dd mysql]# systemctl status mysql.server
● mysql.server.service - LSB: start and stop MySQLLoaded: loaded (/etc/rc.d/init.d/mysql.server; bad; vendor preset: disabled)Active: active (exited) since 二 2024-05-07 14:28:58 CST; 12s agoDocs: man:systemd-sysv-generator(8)Process: 4224 ExecStart=/etc/rc.d/init.d/mysql.server start (code=exited, status=0/SUCCESS)5月 07 14:28:58 vm-3rd89n7dd systemd[1]: Starting LSB: start and stop MySQL...
5月 07 14:28:58 vm-3rd89n7dd mysql.server[4224]: Starting MySQL SUCCESS!
5月 07 14:28:58 vm-3rd89n7dd systemd[1]: Started LSB: start and stop MySQL.
5月 07 14:28:58 vm-3rd89n7dd mysql.server[4224]: 2024-05-07T06:28:58.247390Z mysqld_safe A mysqld process already exists

        第五步,修改临时密码

[root@vm-3rd89n7dd ~]# mysqladmin -uroot -p'jgR;k1H4Wa!f' password 'YourPassword'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

        如果不修改临时密码,并使用临时密码登录操作数据库,系统也会提示修改

[root@vm-3rd89n7dd ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.0-commercialCopyright (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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> exit
Bye

        第六步,为mysql设置环境变量,增加 /usr/local/mysql/bin 路径配置

root@vm-3rd89n7dd ~]# vi .bash_profile 
# .bash_profile# Get the aliases and functions
if [ -f ~/.bashrc ]; then. ~/.bashrc
fi# User specific environment and startup programs
JAVA_HOME=/usr/jdk1.8.0_411
export JAVA_HOMECLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export CLASSPATHPATH=$JAVA_HOME/bin:$PATH:/usr/local/bin:/usr/local/mysql/bin:$HOME/bin
export PATH[root@vm-3rd89n7dd ~]# source .bash_profile

        第七步,登录和操作数据库测试

[root@vm-3rd89n7dd ~]# 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-commercial MySQL Enterprise Server - CommercialCopyright (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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)mysql> exit
Bye

        以上就是MySQL 8.4.0 LTS版本安装、运行的一个基本过程(注意:过程中并未涉及数据库的详细配置,需要的可以在安装过程中自行添加相关配置)。

参考:

https://dev.mysql.com/doc/refman/8.4/en/binary-installation.html


http://www.ppmy.cn/devtools/36646.html

相关文章

js浏览器请求,post请求中的参数形式和form-data提交数据时数据格式问题(2024-05-06)

浏览器几种常见的post请求方式 Content-Type 属性规定在发送到服务器之前应该如何对表单数据进行编码。 默认表单数据会编码为 "application/x-www-form-urlencoded" post请求的参数一般放在Body里。 Content-Type(内容类型),一般…

大数据毕业设计Python+Django旅游景点评论数据采集分析可视化系统 NLP情感分析 LDA主题分析 bayes分类 旅游爬虫 旅游景点评论爬虫 机器学习 深度学习 人工智能 计算机毕业设计

毕业论文(设计)开题报告 学生姓名 学 号 所在学院 信息工程学院 专 业 指导教师姓名 指导教师职称 工程师 助教 指导教师单位 论文(设计)题目 基于朴素贝叶斯算法旅游景点线上评价情感分析 开 题 报 告…

leetcode刷题:884、977

884.比较含退格的字符串 给定 s 和 t 两个字符串&#xff0c;当它们分别被输入到空白的文本编辑器后&#xff0c;如果两者相等&#xff0c;返回 true 。# 代表退格字符。 注意&#xff1a;如果对空文本输入退格字符&#xff0c;文本继续为空。 方法一、用栈 #include <i…

Unity MeshRenderer 入门

概述 在项目制作过程中&#xff0c;肯定缺少不了模型的使用&#xff0c;那就一定接触过MeshRenderer&#xff0c;也许还有你不理解的地方&#xff0c;接下来让我们来学习一下这部分的内容吧。 Mesh Filter&#xff08;网格过滤器&#xff09; Mesh:提供一个网格的参考&#xf…

typescript学习笔记2

交叉类型&#xff08;Intersection Types&#xff09; 交叉类型是将多个类型合并为一个类型。这通过 & 符号实现。 typescript type Combined Type1 & Type2 & Type3; 例如&#xff0c;一个对象可能同时拥有多个接口所定义的属性&#xff1a; typescript interf…

怎么ai解答问题?这三个方法都可以

怎么ai解答问题&#xff1f;在数字化飞速发展的今天&#xff0c;人工智能&#xff08;AI&#xff09;技术已经渗透到我们生活的方方面面&#xff0c;尤其是在解答问题方面&#xff0c;AI展现出了令人瞩目的能力。那么&#xff0c;哪些软件可以利用AI技术解答问题呢&#xff1f;…

【leetcode】优先队列题目总结

优先队列的底层是最大堆或最小堆 priority_queue<Type, Container, Functional>; Type是要存放的数据类型Container是实现底层堆的容器&#xff0c;必须是数组实现的容器&#xff0c;如vector、dequeFunctional是比较方式/比较函数/优先级 priority_queue<Type>…

手动配置dns后网速变慢

之前因为自动的dns能上qq但打不开网页&#xff0c;就手动设置了一个&#xff0c;结果近些天时不时出现网页图片加载慢的问题&#xff0c;影响到我看美女图片了&#xff0c;是可忍熟不可忍 测了下网速&#xff0c;很快&#xff0c;下载上传都是三位数的&#xff0c;那显然不是网…