当前位置: 首页 > news >正文

Linux 服务器 Mysql 8.4.6 安装

说明:本次安装Mysql版本为 Mysql 8.4.6 ,操作系统为 Red Hat Enterprise Linux 9。

1.安装包下载

点击进入如下网址:https://downloads.mysql.com/archives/community/

选择Mysql版本如下:
在这里插入图片描述
选择操作系统如下:
在这里插入图片描述
选择操作系统版本如下:
在这里插入图片描述
选择安装包 RPM Bundle,点击【Download】下载:
在这里插入图片描述

2. 创建目录

# cd /opt
# mkdir mysql

3.上传软件安装包及解压

3.1 通过合适的方法将软件安装包上传到服务器目录/opt/mysql 下
3.2 安装包解压缩

# cd /opt/mysql 
# ll
total 928732
-rw-r--r-- 1 root root 951019520 Nov  7 14:11 mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar# tar -xvf mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar
mysql-community-client-8.4.6-1.el9.x86_64.rpm
mysql-community-client-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-client-plugins-8.4.6-1.el9.x86_64.rpm
mysql-community-client-plugins-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-common-8.4.6-1.el9.x86_64.rpm
mysql-community-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-debugsource-8.4.6-1.el9.x86_64.rpm
mysql-community-devel-8.4.6-1.el9.x86_64.rpm
mysql-community-icu-data-files-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-compat-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-compat-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-server-8.4.6-1.el9.x86_64.rpm
mysql-community-server-debug-8.4.6-1.el9.x86_64.rpm
mysql-community-server-debug-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-server-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-test-8.4.6-1.el9.x86_64.rpm
mysql-community-test-debuginfo-8.4.6-1.el9.x86_64.rpm

4. 安装依赖

# dnf install -y libaio numactl-libs openssl perl

5.按顺序安装RPM 包

# rpm -ivh mysql-community-common-8.4.6-1.el9.x86_64.rpm
warning: mysql-community-common-8.4.6-1.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-common-8.4.6-1.el################################# [100%]# rpm -ivh mysql-community-client-plugins-8.4.6-1.el9.x86_64.rpm
warning: mysql-community-client-plugins-8.4.6-1.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-client-plugins-8.################################# [100%]# rpm -ivh mysql-community-libs-8.4.6-1.el9.x86_64.rpm
warning: mysql-community-libs-8.4.6-1.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-libs-8.4.6-1.el9 ################################# [100%]# rpm -ivh mysql-community-client-8.4.6-1.el9.x86_64.rpm
warning: mysql-community-client-8.4.6-1.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-client-8.4.6-1.el################################# [100%]# rpm -ivh mysql-community-icu-data-files-8.4.6-1.el9.x86_64.rpm
warning: mysql-community-icu-data-files-8.4.6-1.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-icu-data-files-8.################################# [100%]# rpm -ivh mysql-community-server-8.4.6-1.el9.x86_64.rpm
warning: mysql-community-server-8.4.6-1.el9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:mysql-community-server-8.4.6-1.el################################# [100%]

6.初始化 MySQL

# systemctl enable mysqld
# systemctl start mysqld
# systemctl status mysqld

7.获取临时密码

# grep 'temporary password' /var/log/mysqld.log
2025-11-07T06:28:16.249478Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: e8Le0hvudSk_p

8.登录验证

# mysql -u root -p
Enter password:   ----输入上面获取的临时密码

9.修改密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Passwd123';
Query OK, 0 rows affected (0.03 sec)

10.查看版本

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.4.6     |
+-----------+
1 row in set (0.00 sec)

11.修改端口号

--查看当前默认端口
mysql> SHOW VARIABLES LIKE 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+
1 row in set (0.04 sec)--修改端口
编辑/etc/my.cnf,添加如下内容:
port=3307重启MySQL 服务:
systemctl restart mysqld--确认当前端口
mysql> SHOW VARIABLES LIKE 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3307  |
+---------------+-------+
1 row in set (0.04 sec)

12.修改文件存放位置(可选)

当前默认路径:

mysql> SHOW VARIABLES LIKE 'datadir';
+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| datadir       | /var/lib/mysql/ |
+---------------+-----------------+
1 row in set (0.00 sec)

如果需要修改文件存放位置,可通过修改/etc/my.cnf 实现,添加如下内容:

datadir=/Data/mysqldata

重启服务:

# systemctl restart mysqld

验证是否修改成功:

mysql> SHOW VARIABLES LIKE 'datadir';
+---------------+------------------+
| Variable_name | Value            |
+---------------+------------------+
| datadir       | /Data/mysqldata/ |
+---------------+------------------+
1 row in set (0.00 sec)
http://www.dtcms.com/a/602844.html

相关文章:

  • 泸州本地网站建设文化建设的名言警句
  • 网站版权信息模板网易邮箱163登录
  • 建站公司用的服务器广东省建设工程安全协会网站
  • 做家务的男人网站it项目网站开发的需求文档
  • 做化工外贸需要那些网站网站建设_制作_设计
  • 深入讲解C++ 智能指针:原理、使用与实践
  • 【OpenCV + VS】图像的像素位运算
  • 惠州最专业的网站建设公司wordpress七牛云图床
  • 小企业如何建网站北京建设网站官网
  • 模板建站是什么做团购网站怎样赚钱
  • 网站开发需要学什么语言网站设计联系方式
  • CVPR 2025|基于全客户端信息的联邦学习隐私泄露攻击方法
  • 精品成品网站入口h5页面制作平台
  • 频繁查找用哈希,顺序访问用列表
  • 模型蒸馏(Knowledge Distillation)
  • 电商网站合作网页设计图片主流尺寸
  • 投资网站建设及推广北京建设网服务大厅
  • 郑州建设网站的公司阳城seo排名
  • 宜春市城市建设网站苍南县住房和城乡规划建设局网站
  • 浅谈网站规划建设与管理维护企业站模板大全
  • 汕头网站建设维护网站建设的需要的工具
  • 网站提交了被收录后改怎么做php网站后台模板下载不了
  • Q3: create 和 create2 有什么区别?
  • 研发管理知识库(6)什么是CI/CD
  • 数据库知识整理——SQL数据更新
  • win7 iis架设网站思途旅游网站建设系统
  • 反编译易语言 | 探讨易语言的反编译方法与安全性分析
  • 无锡网站营销公司简介郑州加盟网站建设
  • 单位网站建设费用什么会计科目广告优化是做什么的
  • 自动化测试工具Katalon 全面介绍与实际体验