资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

MySQL的rpm安装方式-创新互联

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

成都创新互联是专业的呈贡网站建设公司,呈贡接单;提供成都网站建设、网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行呈贡网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

用于安装MySQL的rpm包如下:

Table 2.6 RPM Packages for MySQL Community Edition

Package Name Summary
mysql-community-server Database server and related tools 数据库服务器和相关工具
mysql-community-client MySQL client applications and tools MySQL客户端应用程序和工具
mysql-community-common Common files for server and client libraries 服务器和客户端库库的通用文件
mysql-community-devel Development header files and libraries for MySQL database client applications
mysql-community-libs Shared libraries for MySQL database client applications
mysql-community-libs-compat Shared compatibility libraries for previous MySQL installations
mysql-community-embedded MySQL embedded library
mysql-community-embedded-devel Development header files and libraries for MySQL as an embeddable library
mysql-community-test Test suite for the MySQL server

Table 2.7 RPM Packages for the MySQL Enterprise Edition

Package Name Summary
mysql-commercial-server Database server and related tools
mysql-commercial-client MySQL client applications and tools
mysql-commercial-common Common files for server and client libraries
mysql-commercial-devel Development header files and libraries for MySQL database client applications
mysql-commercial-libs Shared libraries for MySQL database client applications
mysql-commercial-libs-compat Shared compatibility libraries for previous MySQL installations
mysql-commercial-embedded MySQL embedded library
mysql-commercial-embedded-devel Development header files and libraries for MySQL as an embeddable library
mysql-commercial-test Test 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 Value Intended Use
el5, el6, el7 Red Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7
fc22, fc23 Fedora 22 or 23
sles12 SUSE 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 Resources Location
Client programs and scripts /usr/bin
mysqld server /usr/sbin
Configuration file /etc/my.cnf
Data directory /var/lib/mysql
Error log file For 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 script For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld
For SLES: /etc/init.d/mysql
Systemd service For 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安装方式”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


网站栏目:MySQL的rpm安装方式-创新互联
当前路径:http://cdkjz.cn/article/cdpije.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220