您的位置:首页 > 运维架构 > Linux

在Linux上,使用MySQL的yum仓库,安装MySQL

2016-06-18 16:03 926 查看
部分翻译了“refman-5.7-en.pdf”的“2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository”部分。书写的时候使用了markdown编辑器,算是练手。

- Before You Start



- Steps for a Fresh Installation of MySQL

全新安装MySQL的步骤。

Follow the steps below to install the latest GA version of MySQL with the MySQL Yum repository:

按照下面的步骤,使用MySQL的yum仓库,安装MySQL的最新的GA(Generally Avaliable)版本。

- Adding the MySQL Yum Repository

给自己的机器添加MySQL的yum仓库。

First, add the MySQL Yum repository to your system’s repository list. This is a one-time operation, which can be performed by installing an RPM provided by MySQL. Follow these steps:

首先,增加MySQL的yum仓库到你的系统的仓库列表。这是一个一次性的操作,通过安装一个MySQL提供的RPM包,这个操作可以被完成。请执行以下步骤:

a. Go to the Download MySQL Yum Repository page (http://dev.mysql.com/downloads/repo/yum/) in the MySQL Developer Zone.

打开“Download MySQL Yum Repository”页面。

b. Select and download the release package for your platform.

为你的平台选择一个发布包,然后下载它。这个页面上只有RHEL 5、RHEL 6、RHEL 7、Fedora 22、Fedora 23、Fedora 24的。

c. Install the downloaded release package with the following command (except for EL5-based systems), replacing platform-and-version-specific-package-name with the name of the downloaded RPM package:

用下面的命令安装刚才下载下来的release包(基于EL5的系统除外),用下载下来的RPM包的名字替换“platform-and-version-specific-package-name”。

shell> sudo yum localinstall platform-and-version-specific-package-name.rpm


比如,我下载的是“mysql57-community-release-el7-8.noarch.rpm”,那么我在CentOS 7上就需要执行下列代码:

[root@localhost ~]# yum install mysql57-community-release-el7-8.noarch.rpm


注:对于localinstall和install,可以先man yum,然后搜索“localinstall”字符串,可以发现如下信息:

localinstall:Is used to install a set of local rpm files. If required the enabled repositories will be used to resolve dependencies. Note that the install command will do a local install, if given a filename. This command is maintained for legacy reasons only.

localinstall用于安装一组本地rpm文件。注意:如果给出了一个文件名的话,install命令将会执行本地安装的操作。这个命令(localinstall)仅仅因为历史遗留的原因而被维护着。

The installation command adds the MySQL Yum repository to your system’s repository list and downloads the GnuPG key to check the integrity of the software packages.

安装命令增加MySQL Yum repository到你的系统的repository list,并且下载GnuPG key去校验安装包的完整性。

You can check that the MySQL Yum repository has been successfully added by the following command (for dnf-enabled systems, replace yum in the command with dnf):

通过下面的命令,你可以检验“MySQL Yum repository”有没有成功的增加。

shell> yum repolist enabled | grep "mysql.*-community.*"


Note

Once the MySQL Yum repository is enabled on your system, any systemwide update by the yum update command (or dnf upgrade for dnf-enabled systems) will upgrade MySQL packages on your system and also replace any native third-party packages, if Yum finds replacements for them in the MySQL Yum repository;

一旦MySQL Yum repository在你的系统上启用了,通过yum update命令触发的任何系统级别的更新(or dnf upgrade for dnf-enabled systems),yum会在“MySQL Yum repository”找各种软件的替代品,如果找到了的话,那么将会在你的系统上升级MySQL包,并且还会替换任何原生的第三方包。

- Selecting a Release Series

选择一个Release系列

When using the MySQL Yum repository, the latest GA series (currently MySQL 5.7) is selected for installation by default. If this is what you want, you can skip to the next step, Installing MySQL

当使用MySQL的yum仓库时,最新的GA系列(2016-06-18,现在是MySQL 5.7)是被默认选择并用于安装的。如果这是你想要的,你可以跳到下一步(Installing MySQL)了。

- Installing MySQL

安装MySQL。

Install MySQL by the following command (for dnf-enabled systems, replace yum in the command with dnf):

通过下面的命令安装MySQL(对于使用dnf的系统,把命令中的yum替换为dnf即可):

shell> sudo yum install mysql-community-server


This installs the package for MySQL server (mysql-community-server) and also packages for the components required to run the server, including packages for the client (mysql-communityclient), the common error messages and character sets for client and server (mysql-communitycommon), and the shared client libraries (mysql-community-libs).

这个命令安装了MySQL server包(mysql-community-server),和一些运行server所必须的组件,包括客户端的包(mysql-communityclient),用于客户端和服务器的公共的错误消息和字符集的包(mysql-communitycommon),和(mysql-community-libs)。

- Starting the MySQL Server

启动MySQL服务。

Start the MySQL server with the following command:

用下面的命令启动MySQL服务。

shell> sudo service mysqld start


You can check the status of the MySQL server with the following command:

用下面的命令,你可以检查MySQL服务的状态:

shell> sudo service mysqld status


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

在服务的最初的启动过程中,发生了以下事情,考虑到服务的数据目录是空的:

• The server is initialized

初始化服务。

• An SSL certificate and key files are generated in the data directory.

一个SSL证书和密钥文件在数据目录生成了。

• The validate_password plugin is installed and enabled.

(一个加强密码强度的插件)validate_password密码插件被安装和启用了。

• A superuser account ‘root’@’localhost’ is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:

在MySQL里面创建了一个超级用户’root’@’localhost’。系统自动设置了超级账户的密码,密码被存储到了error log文件中了。使用下面的命令显示它:

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


Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:

尽快的修改root密码。使用生成的临时密码登录MySQL,然后为超级账户设置一个自定义的密码(比如设置成“MyNewPass4!”):

shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';


Note

MySQL’s validate_password plugin is installed by default. This will require that passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.

MySQL的validate_password插件已经被默认安装了。这将需要密码包含至少一个大写字符,一个小写字符,一个数字,和一个特殊字符,密码的总长度至少是8个字符。

For more information on the postinstallation procedures, see Section 2.10, “Postinstallation Setup and Testing”.

更多信息,见“Postinstallation Setup and Testing”。

Note

Compatibility Information for EL7-based platforms: The following RPM packages

from the native software repositories of the platforms are incompatible with the package from the MySQL Yum repository that installs the MySQL server. Once

you have installed MySQL using the MySQL Yum repository, you will not be able to install these packages (and vice versa).

关于EL7-based平台的兼容性信息:这个平台(EL7-based平台)上的原生的软件仓库中的下列RPM包,和,MySQL的yum仓库中的用于安装MySQL Server的那些包,不兼容。一旦你使用MySQL yum仓库安装了MySQL,你将不可以安装下列包(反之亦然)。

• akonadi-mysql

- Installing Additional MySQL Products and Components with Yum

用yum安装附加的MySQL产品和组件。

略。

- Updating MySQL with Yum

用yum更新MySQL。

略。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: