第一次项目上Linux服务器(五:CentOS7下Mysql数据库的安装与配置(转))
好像在CentOS 7系统中,默认安装的mysql是它的分支mariadb。所以不能像CentOS-6.3那样安装,如下:
[root@izwz ~]# yum -y install mysql mysql-server mysql-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package 1:mariadb-5.5.56-2.el7.x86_64 already installed and latest version
No package mysql-server available.
Package 1:mariadb-devel-5.5.56-2.el7.x86_64 already installed and latest version
Nothing to do
所以按如下步骤安装:
1.下载rpm包
[root@izwz ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-release-el7-5    ################################# [100%]
2.查看当前可用的mysql安装资源
[root@izwz ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                  42
mysql-tools-community/x86_64      MySQL Tools Community                       51
mysql56-community/x86_64          MySQL 5.6 Community Server                 361
3.yum安装
[root@izwz ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.38-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.38-2.el7 for package: mysql-community-server-5.6.38-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.38-2.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.6.38-2.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.6.38-2.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.6.38-2.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mariadb.x86_64 1:5.5.56-2.el7 will be obsoleted
---> Package mysql-community-client.x86_64 0:5.6.38-2.el7 will be obsoleting
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.38-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.38-2.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be obsoleted
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.56-2.el7 for package: 1:mariadb-devel-5.5.56-2.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.6.38-2.el7 will be obsoleting
--> Running transaction check
---> Package mariadb-devel.x86_64 1:5.5.56-2.el7 will be obsoleted
---> Package mysql-community-devel.x86_64 0:5.6.38-2.el7 will be obsoleting
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================
 Package                        Arch           Version                 Repository                 Size
=======================================================================================================
Installing:
 mysql-community-client         x86_64         5.6.38-2.el7            mysql56-community          19 M
     replacing  mariadb.x86_64 1:5.5.56-2.el7
 mysql-community-devel          x86_64         5.6.38-2.el7            mysql56-community         3.4 M
     replacing  mariadb-devel.x86_64 1:5.5.56-2.el7
 mysql-community-libs           x86_64         5.6.38-2.el7            mysql56-community         2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.56-2.el7
 mysql-community-server         x86_64         5.6.38-2.el7            mysql56-community          59 M
Installing for dependencies:
 libaio                         x86_64         0.3.109-13.el7          base                       24 k
 mysql-community-common         x86_64         5.6.38-2.el7            mysql56-community         257 k
Transaction Summary
=======================================================================================================
Install  4 Packages (+2 Dependent packages)
Total download size: 84 M
Downloading packages:
(1/6): libaio-0.3.109-13.el7.x86_64.rpm                                         |  24 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.38-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.6.38-2.el7.x86_64.rpm is not installed
(2/6): mysql-community-common-5.6.38-2.el7.x86_64.rpm                           | 257 kB  00:00:00     
(3/6): mysql-community-devel-5.6.38-2.el7.x86_64.rpm                            | 3.4 MB  00:00:00     
(4/6): mysql-community-libs-5.6.38-2.el7.x86_64.rpm                             | 2.0 MB  00:00:00     
(5/6): mysql-community-client-5.6.38-2.el7.x86_64.rpm                           |  19 MB  00:00:02     
(6/6): mysql-community-server-5.6.38-2.el7.x86_64.rpm                           |  59 MB  00:00:05     
-------------------------------------------------------------------------------------------------------
Total                                                                   12 MB/s |  84 MB  00:00:07     
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql-community-release-el7-5.noarch (installed)
 From       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.6.38-2.el7.x86_64                                          1/9 
  Installing : mysql-community-libs-5.6.38-2.el7.x86_64                                            2/9 
  Installing : mysql-community-client-5.6.38-2.el7.x86_64                                          3/9 
  Installing : libaio-0.3.109-13.el7.x86_64                                                        4/9 
  Installing : mysql-community-server-5.6.38-2.el7.x86_64                                          5/9 
  Installing : mysql-community-devel-5.6.38-2.el7.x86_64                                           6/9 
  Erasing    : 1:mariadb-devel-5.5.56-2.el7.x86_64                                                 7/9 
  Erasing    : 1:mariadb-5.5.56-2.el7.x86_64                                                       8/9 
  Erasing    : 1:mariadb-libs-5.5.56-2.el7.x86_64                                                  9/9 
  Verifying  : mysql-community-libs-5.6.38-2.el7.x86_64                                            1/9 
  Verifying  : mysql-community-