MySQL包安装 -- SUSE系列(离线RPM包安装MySQL)

本文涉及的产品
云原生数据库 PolarDB 分布式版,标准版 2核8GB
云数据库 RDS SQL Server,基础系列 2核4GB
RDS PostgreSQL Serverless,0.5-4RCU 50GB 3个月
推荐场景:
对影评进行热评分析
简介: 本文详细介绍在openSUSE系统上通过离线RPM包安装MySQL 8.0和8.4版本的完整步骤,包括下载地址、RPM包解压、GPG密钥导入、使用rpm或zypper命令安装及服务启动验证,涵盖初始密码获取与安全修改方法,适用于无网络环境下的MySQL部署。

2.2.3.2 离线RPM包安装MySQL

2.2.3.2.1 MySQL 8.0

去“https://www.mysql.com/”网站下载,选择“DOWNLOADS”,如图66所示。

t66

图66 下载MySQL RPM包

选择“MySQL Community (GPL) Downloads”,如图67所示。

t67

图67 下载MySQL RPM包

选择“MySQL Community Server(MySQL社区服务器)”,如图68所示。

t68

图68 下载MySQL RPM包

在“openSUSE”上安装MySQL:

"Select Version(选择版本)"为:8.0.43,“Select Operating System(选择操作系统)”为:SUSE Linux Enterprise Server,然后选择”RPM Bundle“后面的”Download“,如图69所示。

t69

图69 下载MySQL RPM包

opensuse15:~ # wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.43-1.sl15.x86_64.rpm-bundle.tar

opensuse15:~ # tar xf mysql-8.0.43-1.sl15.x86_64.rpm-bundle.tar

opensuse15:~ # rpm --import https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023

方法1:rpm命令安装,要按下面执行的顺序安装,否则会报错

opensuse15:~ # rpm -ivh mysql-community-client-plugins-8.0.43-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-common-8.0.43-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-libs-8.0.43-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-client-8.0.43-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-icu-data-files-8.0.43-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-server-8.0.43-1.sl15.x86_64.rpm

方法2:zypper命令安装,从”https://dev.mysql.com/doc/refman/8.4/en/linux-installation-rpm.html“网址看到安装文档

opensuse15:~ # zypper install -y mysql-community-{server,client,client-plugins,icu-data-files,common,libs}-8.0.43-1.sl15.x86_64.rpm

继续安装MySQL:

opensuse15:~ # systemctl enable --now mysql

opensuse15:~ # ls /var/lib/mysql
#ib_16384_0.dblwr  auto.cnf       ca.pem           ibdata1    mysql.sock          public_key.pem   undo_001
#ib_16384_1.dblwr  binlog.000001  client-cert.pem  ibtmp1     mysql.sock.lock     server-cert.pem  undo_002
#innodb_redo       binlog.index   client-key.pem   mysql      performance_schema  server-key.pem
#innodb_temp       ca-key.pem     ib_buffer_pool   mysql.ibd  private_key.pem     sys

opensuse15:~ # mysql -V
mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)

opensuse15:~ # systemctl status mysql
● mysql.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-10-03 15:15:20 CST; 29s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 13833 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 13897 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 2250)
        CPU: 5.358s
     CGroup: /system.slice/mysql.service
             └─13897 /usr/sbin/mysqld

Oct 03 15:15:12 opensuse15 systemd[1]: Starting MySQL Server...
Oct 03 15:15:19 opensuse15 (mysqld)[13897]: mysql.service: Referenced but unset environment variable evaluates t>
Oct 03 15:15:20 opensuse15 systemd[1]: Started MySQL Server.

# 获取MySQL初始密码
opensuse15:~ # grep password /var/log/mysql/mysqld.log
2025-10-03T07:15:15.023729Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: qlyCwXu%K7.Z
# "qlyCwXu%K7.Z"就是MySQL的初始密码

# 修改mysql密码
opensuse15:~ # mysqladmin -uroot -p'qlyCwXu%K7.Z' password 123456
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.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单

opensuse15:~ # mysqladmin -uroot -p'qlyCwXu%K7.Z' password Raymond@2025
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.

opensuse15:~ # mysql -uroot -p'Raymond@2025'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.43 MySQL Community Server - GPL

Copyright (c) 2000, 2025, 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
--------------
mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)

Connection id:        10
Current database:    
Current user:        root@localhost
SSL:            Not in use
Current pager:        less
Using outfile:        ''
Using delimiter:    ;
Server version:        8.0.43 MySQL Community Server - GPL
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:            3 min 10 sec

Threads: 2  Questions: 8  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 46  Queries per second avg: 0.042
--------------

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
2.2.3.2.2 MySQL 8.4

去“https://www.mysql.com/”网站下载,选择“DOWNLOADS”,如图70所示。

t70

图70 下载MySQL RPM包

选择“MySQL Community (GPL) Downloads”,如图71所示。

t71

图71 下载MySQL RPM包

选择“MySQL Community Server(MySQL社区服务器)”,如图72所示。

t72

图72 下载MySQL RPM包

在“openSUSE”上安装MySQL:

"Select Version(选择版本)"为:8.0.43,“Select Operating System(选择操作系统)”为:SUSE Linux Enterprise Server,然后选择”RPM Bundle“后面的”Download“,如图73所示。

t73

图73 下载MySQL RPM包

opensuse15:~ # wget https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-8.4.6-1.sl15.x86_64.rpm-bundle.tar

opensuse15:~ # tar xf mysql-8.4.6-1.sl15.x86_64.rpm-bundle.tar

opensuse15:~ # rpm --import https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023

方法1:rpm命令安装,要按下面执行的顺序安装,否则会报错

opensuse15:~ # rpm -ivh mysql-community-client-plugins-8.4.6-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-common-8.4.6-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-libs-8.4.6-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-client-8.4.6-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-icu-data-files-8.4.6-1.sl15.x86_64.rpm

opensuse15:~ # rpm -ivh mysql-community-server-8.4.6-1.sl15.x86_64.rpm

方法2:zypper命令安装,从”https://dev.mysql.com/doc/refman/8.4/en/linux-installation-rpm.html“网址看到安装文档

opensuse15:~ # zypper install -y mysql-community-{server,client,client-plugins,icu-data-files,common,libs}-8.0.43-1.sl15.x86_64.rpm

继续安装MySQL:

opensuse15:~ # systemctl enable --now mysql

opensuse15:~ # ls /var/lib/mysql
#ib_16384_0.dblwr  auto.cnf       ca.pem           ibdata1    mysql.sock             private_key.pem  sys
#ib_16384_1.dblwr  binlog.000001  client-cert.pem  ibtmp1     mysql.sock.lock        public_key.pem   undo_001
#innodb_redo       binlog.index   client-key.pem   mysql      mysql_upgrade_history  server-cert.pem  undo_002
#innodb_temp       ca-key.pem     ib_buffer_pool   mysql.ibd  performance_schema     server-key.pem

opensuse15:~ # mysql -V
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)

opensuse15:~ # systemctl status mysql
● mysql.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-10-03 16:29:00 CST; 30s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 13709 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 13771 (mysqld)
     Status: "Server is operational"
      Tasks: 35 (limit: 2250)
        CPU: 4.747s
     CGroup: /system.slice/mysql.service
             └─13771 /usr/sbin/mysqld

Oct 03 16:28:53 opensuse15 systemd[1]: Starting MySQL Server...
Oct 03 16:28:59 opensuse15 (mysqld)[13771]: mysql.service: Referenced but unset environment variable evaluates t>
Oct 03 16:29:00 opensuse15 systemd[1]: Started MySQL Server.

# 获取MySQL初始密码
opensuse15:~ # grep password /var/log/mysql/mysqld.log
2025-10-03T08:28:56.486012Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: w/#MU*%7LP9U
# "w/#MU*%7LP9U"就是MySQL的初始密码

# 修改mysql密码
opensuse15:~ # mysqladmin -uroot -p'w/#MU*%7LP9U' password 123456
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.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单

opensuse15:~ # mysqladmin -uroot -p'w/#MU*%7LP9U' password Raymond@2025
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.

opensuse15:~ # mysql -uroot -p'Raymond@2025'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.4.6 MySQL Community Server - GPL

Copyright (c) 2000, 2025, 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
--------------
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)

Connection id:        9
Current database:    
Current user:        root@localhost
SSL:            Not in use
Current pager:        less
Using outfile:        ''
Using delimiter:    ;
Server version:        8.4.6 MySQL Community Server - GPL
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:            1 min 30 sec

Threads: 2  Questions: 9  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 46  Queries per second avg: 0.100
--------------

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
相关文章
|
1月前
|
Ubuntu 关系型数据库 MySQL
MySQL源码编译安装
本文详细介绍了MySQL 8.0及8.4版本的源码编译安装全过程,涵盖用户创建、依赖安装、cmake配置、编译优化等步骤,并提供支持多Linux发行版的一键安装脚本,适用于定制化数据库部署需求。
180 4
MySQL源码编译安装
|
1月前
|
Ubuntu 关系型数据库 MySQL
MySQL二进制包安装
本文详细介绍了在多种Linux系统上通过二进制包安装MySQL 8.0和8.4版本的完整过程,涵盖用户创建、glibc版本匹配、程序解压、环境变量配置、初始化数据库及服务启动等步骤,并提供支持多发行版的一键安装脚本,助力高效部署MySQL环境。
193 4
MySQL二进制包安装
|
1月前
|
NoSQL 算法 Redis
【Docker】(3)学习Docker中 镜像与容器数据卷、映射关系!手把手带你安装 MySql主从同步 和 Redis三主三从集群!并且进行主从切换与扩容操作,还有分析 哈希分区 等知识点!
Union文件系统(UnionFS)是一种**分层、轻量级并且高性能的文件系统**,它支持对文件系统的修改作为一次提交来一层层的叠加,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem) Union 文件系统是 Docker 镜像的基础。 镜像可以通过分层来进行继承,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
282 5
|
2月前
|
缓存 关系型数据库 BI
使用MYSQL Report分析数据库性能(下)
使用MYSQL Report分析数据库性能
112 3
|
2月前
|
关系型数据库 MySQL 数据库
自建数据库如何迁移至RDS MySQL实例
数据库迁移是一项复杂且耗时的工程,需考虑数据安全、完整性及业务中断影响。使用阿里云数据传输服务DTS,可快速、平滑完成迁移任务,将应用停机时间降至分钟级。您还可通过全量备份自建数据库并恢复至RDS MySQL实例,实现间接迁移上云。
|
3月前
|
存储 运维 关系型数据库
从MySQL到云数据库,数据库迁移真的有必要吗?
本文探讨了企业在业务增长背景下,是否应从 MySQL 迁移至云数据库的决策问题。分析了 MySQL 的优势与瓶颈,对比了云数据库在存储计算分离、自动化运维、多负载支持等方面的优势,并提出判断迁移必要性的五个关键问题及实施路径,帮助企业理性决策并落地迁移方案。
|
2月前
|
关系型数据库 MySQL 分布式数据库
阿里云PolarDB云原生数据库收费价格:MySQL和PostgreSQL详细介绍
阿里云PolarDB兼容MySQL、PostgreSQL及Oracle语法,支持集中式与分布式架构。标准版2核4G年费1116元起,企业版最高性能达4核16G,支持HTAP与多级高可用,广泛应用于金融、政务、互联网等领域,TCO成本降低50%。
|
2月前
|
关系型数据库 MySQL 数据库
阿里云数据库RDS费用价格:MySQL、SQL Server、PostgreSQL和MariaDB引擎收费标准
阿里云RDS数据库支持MySQL、SQL Server、PostgreSQL、MariaDB,多种引擎优惠上线!MySQL倚天版88元/年,SQL Server 2核4G仅299元/年,PostgreSQL 227元/年起。高可用、可弹性伸缩,安全稳定。详情见官网活动页。
|
2月前
|
关系型数据库 分布式数据库 数据库
阿里云数据库收费价格:MySQL、PostgreSQL、SQL Server和MariaDB引擎费用整理
阿里云数据库提供多种类型,包括关系型与NoSQL,主流如PolarDB、RDS MySQL/PostgreSQL、Redis等。价格低至21元/月起,支持按需付费与优惠套餐,适用于各类应用场景。

相关产品

  • 云数据库 RDS MySQL 版
  • 推荐镜像

    更多