MySQL包安装 -- SUSE系列(SUSE资源库安装MySQL)

本文涉及的产品
云数据库 RDS SQL Server,基础系列 2核4GB
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS PostgreSQL Serverless,0.5-4RCU 50GB 3个月
推荐场景:
对影评进行热评分析
简介: 本文介绍了在openSUSE系统上通过SUSE资源库安装MySQL 8.0和8.4版本的完整步骤,包括配置国内镜像源、安装MySQL服务、启动并验证运行状态,以及修改初始密码等操作,适用于希望在SUSE系列系统中快速部署MySQL的用户。

2.2.3 SUSE系列

2.2.3.1 SUSE资源库安装MySQL

2.2.3.1.1 MySQL 8.0

在"openSUSE"上安装MySQL:

opensuse15:~ # wget https://repo.mysql.com//mysql80-community-release-sl15-1.noarch.rpm

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

opensuse15:~ # rpm -Uvh mysql80-community-release-sl15-1.noarch.rpm 

# 替换国内镜像源
sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/zypp/repos.d/mysql-community*.repo

opensuse15:~ # zypper refresh

opensuse15:~ # zypper search "mysql-community-server"
Loading repository data...
Reading installed packages...

S | Name                         | Summary                                      | Type
--+------------------------------+----------------------------------------------+--------
  | mysql-community-server       | A very fast and reliable SQL database server | package
  | mysql-community-server-debug | The debug version of MySQL server            | package

opensuse15:~ # zypper info "mysql-community-server"
Loading repository data...
Reading installed packages...


Information for package mysql-community-server:
-----------------------------------------------
Repository     : MySQL 8.0 Community Server
Name           : mysql-community-server
Version        : 8.0.43-1.sl15
Arch           : x86_64
Vendor         : Oracle and/or its affiliates
Installed Size : 401.4 MiB
Installed      : No
Status         : not installed
Source package : mysql-community-8.0.43-1.sl15.src
Upstream URL   : http://www.mysql.com/
Summary        : A very fast and reliable SQL database server
Description    : 
    The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
    and robust SQL (Structured Query Language) database server. MySQL Server
    is intended for mission-critical, heavy-load production systems as well
    as for embedding into mass-deployed software. MySQL is a trademark of
    Oracle and/or its affiliates

    The MySQL software has Dual Licensing, which means you can use the MySQL
    software free of charge under the GNU General Public License
    (http://www.gnu.org/licenses/). You can also purchase commercial MySQL
    licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
    the GPL. See the chapter "Licensing and Support" in the manual for
    further info.

    The MySQL web site (http://www.mysql.com/) provides the latest news and
    information about the MySQL software.  Also please see the documentation
    and the manual for more information.

    This package includes the MySQL server binary as well as related utilities
    to run and administer a MySQL server.

opensuse15:~ # zypper install -y mysql-community-server

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 14:52:18 CST; 34s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 13723 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 13787 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 2250)
        CPU: 5.712s
     CGroup: /system.slice/mysql.service
             └─13787 /usr/sbin/mysqld

Oct 03 14:52:10 opensuse15 systemd[1]: Starting MySQL Server...
Oct 03 14:52:17 opensuse15 (mysqld)[13787]: mysql.service: Referenced but unset environment variable evaluates t>
Oct 03 14:52:18 opensuse15 systemd[1]: Started MySQL Server.

# 获取MySQL初始密码
opensuse15:~ # grep 'temporary password' /var/log/mysql/mysqld.log
2025-10-03T06:52:13.198731Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: y;_44nus=q8U
# "y;_44nus=q8U"就是MySQL的初始密码

# 修改mysql密码
opensuse15:~ # mysqladmin -uroot -p'y;_44nus=q8U' 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'y;_44nus=q8U' 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.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:        9
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:            1 min 49 sec

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

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

mysql> exit
Bye
2.2.3.1.2 MySQL 8.4

在"openSUSE"上安装MySQL:

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

t62

图62 下载SUSE仓库包

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

t63

图63 下载SUSE仓库包

选择“MySQL SUSE Repository(MySQL SUSE资源库)”,如图64所示。

t64

图64 下载SUSE仓库包

然后根据系统版本下载相应的安装包,如图65所示。

t65

图65 下载SUSE仓库包

opensuse15:~ # wget https://dev.mysql.com/get/mysql84-community-release-sl15-1.noarch.rpm

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

opensuse15:~ # rpm -Uvh mysql84-community-release-sl15-1.noarch.rpm

# 替换国内镜像源
sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/zypp/repos.d/mysql-community*.repo

opensuse15:~ # zypper update -y mysql84-community-release

opensuse15:~ # zypper refresh

opensuse15:~ # zypper search "mysql-community-server"
Loading repository data...
Reading installed packages...

S | Name                         | Summary                                      | Type
--+------------------------------+----------------------------------------------+--------
  | mysql-community-server       | A very fast and reliable SQL database server | package
  | mysql-community-server-debug | The debug version of MySQL server            | package

opensuse15:~ # zypper info mysql-community-server
Loading repository data...
Reading installed packages...


Information for package mysql-community-server:
-----------------------------------------------
Repository     : MySQL 8.4 LTS Community Server
Name           : mysql-community-server
Version        : 8.4.6-1.sl15
Arch           : x86_64
Vendor         : Oracle and/or its affiliates
Installed Size : 380.0 MiB
Installed      : No
Status         : not installed
Source package : mysql-community-8.4.6-1.sl15.src
Upstream URL   : http://www.mysql.com/
Summary        : A very fast and reliable SQL database server
Description    : 
    The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
    and robust SQL (Structured Query Language) database server. MySQL Server
    is intended for mission-critical, heavy-load production systems as well
    as for embedding into mass-deployed software. MySQL is a trademark of
    Oracle and/or its affiliates

    The MySQL software has Dual Licensing, which means you can use the MySQL
    software free of charge under the GNU General Public License
    (http://www.gnu.org/licenses/). You can also purchase commercial MySQL
    licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
    the GPL. See the chapter "Licensing and Support" in the manual for
    further info.

    The MySQL web site (http://www.mysql.com/) provides the latest news and
    information about the MySQL software.  Also please see the documentation
    and the manual for more information.

    This package includes the MySQL server binary as well as related utilities
    to run and administer a MySQL server.

opensuse15:~ # zypper install -y mysql-community-server

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:08:08 CST; 29s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 13988 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 14050 (mysqld)
     Status: "Server is operational"
      Tasks: 35 (limit: 2250)
        CPU: 4.965s
     CGroup: /system.slice/mysql.service
             └─14050 /usr/sbin/mysqld

Oct 03 16:08:01 opensuse15 systemd[1]: Starting MySQL Server...
Oct 03 16:08:06 opensuse15 (mysqld)[14050]: mysql.service: Referenced but unset environment variable evaluates t>
Oct 03 16:08:08 opensuse15 systemd[1]: Started MySQL Server.

# 获取MySQL初始密码
opensuse15:~ # grep 'temporary password' /var/log/mysql/mysqld.log
2025-10-03T08:08:04.005002Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: a/i1hpY;b8s#
# "a/i1hpY;b8s#"就是MySQL的初始密码

# 修改mysql密码
opensuse15:~ #  mysqladmin -uroot -p'a/i1hpY;b8s#' 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'a/i1hpY;b8s#' 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 35 sec

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

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

mysql> exit
Bye

相关文章
|
8天前
|
存储 关系型数据库 分布式数据库
PostgreSQL 18 发布,快来 PolarDB 尝鲜!
PostgreSQL 18 发布,PolarDB for PostgreSQL 全面兼容。新版本支持异步I/O、UUIDv7、虚拟生成列、逻辑复制增强及OAuth认证,显著提升性能与安全。PolarDB-PG 18 支持存算分离架构,融合海量弹性存储与极致计算性能,搭配丰富插件生态,为企业提供高效、稳定、灵活的云数据库解决方案,助力企业数字化转型如虎添翼!
|
7天前
|
存储 人工智能 Java
AI 超级智能体全栈项目阶段二:Prompt 优化技巧与学术分析 AI 应用开发实现上下文联系多轮对话
本文讲解 Prompt 基本概念与 10 个优化技巧,结合学术分析 AI 应用的需求分析、设计方案,介绍 Spring AI 中 ChatClient 及 Advisors 的使用。
337 130
AI 超级智能体全栈项目阶段二:Prompt 优化技巧与学术分析 AI 应用开发实现上下文联系多轮对话
|
19天前
|
弹性计算 关系型数据库 微服务
基于 Docker 与 Kubernetes(K3s)的微服务:阿里云生产环境扩容实践
在微服务架构中,如何实现“稳定扩容”与“成本可控”是企业面临的核心挑战。本文结合 Python FastAPI 微服务实战,详解如何基于阿里云基础设施,利用 Docker 封装服务、K3s 实现容器编排,构建生产级微服务架构。内容涵盖容器构建、集群部署、自动扩缩容、可观测性等关键环节,适配阿里云资源特性与服务生态,助力企业打造低成本、高可靠、易扩展的微服务解决方案。
1331 8
|
7天前
|
人工智能 Java API
AI 超级智能体全栈项目阶段一:AI大模型概述、选型、项目初始化以及基于阿里云灵积模型 Qwen-Plus实现模型接入四种方式(SDK/HTTP/SpringAI/langchain4j)
本文介绍AI大模型的核心概念、分类及开发者学习路径,重点讲解如何选择与接入大模型。项目基于Spring Boot,使用阿里云灵积模型(Qwen-Plus),对比SDK、HTTP、Spring AI和LangChain4j四种接入方式,助力开发者高效构建AI应用。
329 122
AI 超级智能体全栈项目阶段一:AI大模型概述、选型、项目初始化以及基于阿里云灵积模型 Qwen-Plus实现模型接入四种方式(SDK/HTTP/SpringAI/langchain4j)
|
6天前
|
监控 JavaScript Java
基于大模型技术的反欺诈知识问答系统
随着互联网与金融科技发展,网络欺诈频发,构建高效反欺诈平台成为迫切需求。本文基于Java、Vue.js、Spring Boot与MySQL技术,设计实现集欺诈识别、宣传教育、用户互动于一体的反欺诈系统,提升公众防范意识,助力企业合规与用户权益保护。
|
18天前
|
机器学习/深度学习 人工智能 前端开发
通义DeepResearch全面开源!同步分享可落地的高阶Agent构建方法论
通义研究团队开源发布通义 DeepResearch —— 首个在性能上可与 OpenAI DeepResearch 相媲美、并在多项权威基准测试中取得领先表现的全开源 Web Agent。
1417 87
|
6天前
|
JavaScript Java 大数据
基于JavaWeb的销售管理系统设计系统
本系统基于Java、MySQL、Spring Boot与Vue.js技术,构建高效、可扩展的销售管理平台,实现客户、订单、数据可视化等全流程自动化管理,提升企业运营效率与决策能力。
|
7天前
|
弹性计算 安全 数据安全/隐私保护
2025年阿里云域名备案流程(新手图文详细流程)
本文图文详解阿里云账号注册、服务器租赁、域名购买及备案全流程,涵盖企业实名认证、信息模板创建、域名备案提交与管局审核等关键步骤,助您快速完成网站上线前的准备工作。
258 82
2025年阿里云域名备案流程(新手图文详细流程)