介绍在CentOS7上yum安装数据库服务器MySQL Community Server 5.7的方法。
CentOS7默认安装了和MySQL有兼容性的MariaDB数据库,在我们安装MySQL5.7之前为了避免发生冲突首先删除MariaDB。
# rpm -qa | grep maria mariadb-libs-5.5.50-1.el7_2.x86_64 # yum remove mariadb-libs -y在CentOS7上yum安装MySQL需使用MySQL的yum源。执行以下命令首先添加MySQL的yum源。
# yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm添加MySQL的yum源之后可以使用yum info命令搜索mysql-community-server,确认详细的信息。
# yum info mysql-community-server Available Packages Name : mysql-community-server Arch : x86_64 Version : 5.7.14 Release : 1.el7 Size : 152 M Repo : mysql57-community/x86_64 Summary : A very fast and reliable SQL database server URL : http://www.mysql.com/ License : Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field. Description : ........以上yum info命令是2016年8月28日的执行结果,当前安装的MySQL版本是5.7.14。确认安装版本之后执行以下命令进行安装。
# yum install mysql-community-server -y到此MySQL5.7安装就完成了,接下来确认安装的MySQL版本。
# mysqld --version mysqld Ver 5.7.14 for Linux on x86_64 (MySQL Community Server (GPL))完成安装步骤之后,首先配置MySQL的开机自动启动,在这里使用systemctl命令。
# systemctl enable mysqld.service接着使用systemctl start mysqld.service命令启动MySQL。
# systemctl start mysqld.service而停止MySQL时使用systemctl stop mysqld.service命令。
# systemctl stop mysqld.service以上是在CentOS7.2安装MySQL Community Server 5.7的步骤,但仅限于安装后续还需要根据开发的系统进行配置。
MySQL5.7开始MySQL管理用户root的密码,会默认生成并记录到/var/log/mysqld.log文件里,不要忘记修改默认密码。
[Note] A temporary password is generated for root@localhost: lQidlh;BX4*x转载于:https://www.cnblogs.com/whlives/p/6817042.html
相关资源:centos7下安装mysql5.7步骤