千家信息网

MySQL的rpm安装方式

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,本篇内容主要讲解"MySQL的rpm安装方式",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"MySQL的rpm安装方式"吧!用于安装MySQL的rpm包如下
千家信息网最后更新 2026年11月03日MySQL的rpm安装方式

本篇内容主要讲解"MySQL的rpm安装方式",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"MySQL的rpm安装方式"吧!

用于安装MySQL的rpm包如下:

Table 2.6 RPM Packages for MySQL Community Edition

Package NameSummary
mysql-community-serverDatabase server and related tools 数据库服务器和相关工具
mysql-community-clientMySQL client applications and tools MySQL客户端应用程序和工具
mysql-community-commonCommon files for server and client libraries 服务器和客户端库库的通用文件
mysql-community-develDevelopment header files and libraries for MySQL database client applications
mysql-community-libsShared libraries for MySQL database client applications
mysql-community-libs-compatShared compatibility libraries for previous MySQL installations
mysql-community-embeddedMySQL embedded library
mysql-community-embedded-develDevelopment header files and libraries for MySQL as an embeddable library
mysql-community-testTest suite for the MySQL server

Table 2.7 RPM Packages for the MySQL Enterprise Edition

Package NameSummary
mysql-commercial-serverDatabase server and related tools
mysql-commercial-clientMySQL client applications and tools
mysql-commercial-commonCommon files for server and client libraries
mysql-commercial-develDevelopment header files and libraries for MySQL database client applications
mysql-commercial-libsShared libraries for MySQL database client applications
mysql-commercial-libs-compatShared compatibility libraries for previous MySQL installations
mysql-commercial-embeddedMySQL embedded library
mysql-commercial-embedded-develDevelopment header files and libraries for MySQL as an embeddable library
mysql-commercial-testTest suite for the MySQL server

rpm包的语法格式:

packagename-version-distribution-arch.rpm

The distribution and arch values indicate the Linux distribution and the processor type for which the package was built. See the table below for lists of the distribution identifiers:

Table 2.8 MySQL Linux RPM Package Distribution Identifiers

distribution ValueIntended Use
el5, el6, el7Red Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7
fc22, fc23Fedora 22 or 23
sles12SUSE Linux Enterprise Server 12

查看rpm包中所有文件(for example, mysql-community-server):

shell> rpm -qpl mysql-community-server-version-distribution-arch.rpm

本章剩余章节只适合从Oracle下载的包的安装过程,不适用于MySQL库的安装。

包中存在一些依赖关系。如果你打算安装好几个包,你应该选择下载tar格式的rpm包群,包群里包含了上述所有包,如此一来你便不用分别下载它们。

大多数情况下,你需要安装mysql-community-server, mysql-community-client, mysql-community-libs, mysql-community-common, and mysql-community-libs-compat这五个包来得到一个可用的、标准的MySQL系统。要执行这样一个标准的、最小化的安装,切换到这些包所在的文件夹的路径,在除了Red Hat Enterprise Linux/Oracle Linux/CentOS 5平台下执行如下命令:

shell> sudo yum install mysql-community-{server,client,common,libs}-*

Replace yum with zypper for SLES systems, and with dnf for dnf-enabled systems (like Fedora 22).

对于Red Hat Enterprise Linux/Oracle Linux/CentOS 5平台,有一个额外的包需要安装:mysql-version-el5-arch.rpm,使用如下命令:

shell> sudo yum install mysql-community-{server,client,common,libs}-* mysql-5.*

尽管使用一个高级的包管理工具例如yum来安装包会是极佳的选择,但是仍有用户喜欢直接使用rpm的命令rpm -Uvh来安装,这种方式会增加失败的风险,因为可能会遇到潜在的依赖包的问题。

To install only the client programs, you can skip mysql-community-server in your list of packages to install; issue the following command for platforms other than Red Hat Enterprise Linux/Oracle Linux/CentOS 5:

shell> sudo yum install mysql-community-{client,common,libs}-*

Replace yum with zypper for SLES systems, and with dnf for dnf-enabled systems (like Fedora 22).

For Red Hat Enterprise Linux/Oracle Linux/CentOS 5 systems:

shell> sudo yum install mysql-community-{client,common,libs}-* mysql-5.*

A standard installation of MySQL using the RPM packages result in files and resources created under the system directories, shown in the following table.

MySQL安装的默认布局如下:

Table 2.9 MySQL Installation Layout for Linux RPM Packages from the MySQL Developer Zone

Files or ResourcesLocation
Client programs and scripts/usr/bin
mysqld server/usr/sbin
Configuration file/etc/my.cnf
Data directory/var/lib/mysql
Error log fileFor RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log
For SLES: /var/log/mysql/mysqld.log
Value of secure_file_priv/var/lib/mysql-files
System V init scriptFor RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld
For SLES: /etc/init.d/mysql
Systemd serviceFor RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld
For SLES: mysql
Pid file/var/run/mysql/mysqld.pid
Socket/var/lib/mysql/mysql.sock
Keyring directory/var/lib/mysql-keyring
Unix manual pages/usr/share/man
Include (header) files/usr/include/mysql
Libraries/usr/lib/mysql
Miscellaneous support files (for example, error messages, and character set files)/usr/share/mysql

安装同时会在操作系统上创建一个名为mysql的用户和一个名为mysql的组。

Note

使用旧的安装包来安装原来的版本的MySQL可能会创建一个叫做/usr/my.cnf的配置文件。强烈建议您检查该文件的内容并将有用的设置迁移到文件/etc/my.cnf中,然后移除/usr/my.cnf。

在安装过程的最后,MySQL并不会自动启动。对于Red Hat Enterprise Linux, Oracle Linux, CentOS, and Fedora systems,使用如下命令启动MySQL:

shell> sudo service mysqld start

对于For SLES systems, 命令一样,但是服务名不同:

shell> sudo service mysql start

如果操作系统启用了systemd,那么标准的service命令例如stop,start,status以及restart都应该可以用来管理MySQL服务器的服务。mysqld服务默认开启,并跟随系统启动。注意,有些事情在systemd平台上会表现的不一致:例如,改变数据目录的位置可能会产生问题。

At the initial start up of the server, the following happens, given that the data directory of the server is empty:

在服务器初始化启动阶段,会发生下列事情,前提是该服务器的数据目录没数据:

  • 服务器初始化。

  • 一个SSL证书和密钥文件在数据目录中产生。

  • validate_password plugin插件安装并生效。

  • 一个超级用户帐号'root'@'localhost'创建。该超级用户的密码已设置并存储在错误日志文件中。要找到它,RHEL, Oracle Linux, CentOS, and Fedora systems使用如下命令:

shell> sudo grep 'temporary password' /var/log/mysqld.log

Use the following command for SLES systems:

shell> sudo grep 'temporary password' /var/log/mysql/mysqld.log

接下来是利用刚生成的临时密码登录数据库并为该超级用户帐号设置一个典型的密码:

shell> mysql -uroot -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

Note

MySQL默认安装 validate_password插件。该插件要求密码包含至少一个大写字母,一个小写字母,一个数字以及一个特殊字符,同时密码长度至少8位。

如果安装过程中出现错误,你可以去错误日志文件/var/log/mysqld.log查找相关信息。对于某些Linux平台,有必要提高对mysqld可用的文件描述符的限制。

到此,相信大家对"MySQL的rpm安装方式"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

文件 服务 命令 数据 服务器 密码 用户 方式 平台 系统 内容 工具 插件 标准 目录 过程 错误 来安 操作系统 事情 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 上海喔噻互联网科技有限公司 互联网科技工作委员会副主任毛军 互联网科技工作委员会毛军 科技赋能下的互联网金融 互联网 科技创新 奇酷互联网科技公司 互联网与未来科技 碳银互联网科技有限公司 佰商互联网科技有限公司 互联网金融监管科技 互联网实体化科技化 江苏南京365互联网科技 创业天下互联网科技有限公司 宜昌元轩互联网科技有限公司 开一家科技互联网公司需要多少钱 中国互联网十大科技股排名 爱医互联网络科技 银行科技岗属于互联网吗 广州三三互联网科技有限公司 山东亿川互联网科技有限责任公司 互联网科技公司起名 善班互联网科技有限公司 互联网金融科技平台 顺玮阁互联网科技 互联网和高科技公司 字节跳动和互联网科技 亳州好赞互联网科技有限公司 工业互联网展湾科技股份有限公司 同城互联网络科技 现代互联网科技公司
0