Centos7 安装最新版本的mariadb

参考地址:https://downloads.mariadb.org/mariadb/repositories/#mirror=shanghai-university

1. 选择操作系统centos7

2.创建repo文件

输入内容;
# MariaDB 10.3 CentOS repository list - created 2018-06-05 06:27 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

然后进行安装
sudo yum install MariaDB-server MariaDB-client

启动mariadb

systemctl start mariadb

设置开机启动
systemctl enable mariadb

初始化
mysql_secure_installation

登陆
mysql -uroot -p password

centos7 安装 mariadb 出现冲突

今天在一台centos7的机器上安装mariadb 出现故障:

[root@localhost ~]# yum install  mariadb101u-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * epel: mirror.premi.st
 * extras: mirrors.tuna.tsinghua.edu.cn
 * ius: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.nwsuaf.edu.cn
 * webtatic: sp.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package mariadb101u-server.x86_64 1:10.1.21-1.ius.centos7 will be installed
--> Processing Dependency: mariadb101u-common(x86-64) = 1:10.1.21-1.ius.centos7 for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: mariadb101u-config(x86-64) = 1:10.1.21-1.ius.centos7 for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: mariadb101u-errmsg(x86-64) = 1:10.1.21-1.ius.centos7 for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: mariadb101u-libs(x86-64) = 1:10.1.21-1.ius.centos7 for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: lsof for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: mariadb101u(x86-64) for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: net-tools for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: perl(DBD::mysql) for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Processing Dependency: rsync for package: 1:mariadb101u-server-10.1.21-1.ius.centos7.x86_64
--> Running transaction check
---> Package lsof.x86_64 0:4.87-4.el7 will be installed
---> Package mariadb101u.x86_64 1:10.1.21-1.ius.centos7 will be installed
---> Package mariadb101u-common.x86_64 1:10.1.21-1.ius.centos7 will be installed
---> Package mariadb101u-config.x86_64 1:10.1.21-1.ius.centos7 will be installed
---> Package mariadb101u-errmsg.x86_64 1:10.1.21-1.ius.centos7 will be installed
---> Package mariadb101u-libs.x86_64 1:10.1.21-1.ius.centos7 will be installed
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
---> Package rsync31u.x86_64 0:3.1.2-1.ius.centos7 will be installed
--> Running transaction check
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Processing Conflict: 1:mariadb101u-config-10.1.21-1.ius.centos7.x86_64 conflicts mariadb-libs < 1:10.1.21-1.ius.centos7 --> Processing Conflict: 1:mariadb101u-libs-10.1.21-1.ius.centos7.x86_64 conflicts mariadb-libs < 1:10.1.21-1.ius.centos7 --> Finished Dependency Resolution
Error: mariadb101u-libs conflicts with 1:mariadb-libs-5.5.52-1.el7.x86_64
Error: mariadb101u-config conflicts with 1:mariadb-libs-5.5.52-1.el7.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

按照之前看到的文章:
https://ninghao.net/blog/1368

系统本身自带 MariaDB,我们需要先删除掉系统本身带的,才能正常安装比较新的

yum remove mariadb-libs -y
[root@localhost ~]# yum remove mariadb-libs -y
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be erased
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.10.1-6.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
 Package                                     Arch                                  Version                                        Repository                                Size
=================================================================================================================================================================================
Removing:
 mariadb-libs                                x86_64                                1:5.5.52-1.el7                                 @base                                    4.4 M
Removing for dependencies:
 postfix                                     x86_64                                2:2.10.1-6.el7                                 @anaconda                                 12 M

Transaction Summary
=================================================================================================================================================================================
Remove  1 Package (+1 Dependent package)

Installed size: 17 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 2:postfix-2.10.1-6.el7.x86_64                                                                                                                                 1/2
  Erasing    : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                                                            2/2
  Verifying  : 2:postfix-2.10.1-6.el7.x86_64                                                                                                                                 1/2
  Verifying  : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                                                                            2/2

Removed:
  mariadb-libs.x86_64 1:5.5.52-1.el7

Dependency Removed:
  postfix.x86_64 2:2.10.1-6.el7

Complete!

然后再次进行安装,一切顺利

yum install mariadb101-server

然后启动

[root@localhost ~]# systemctl start mariadb

添加到开机启动中。

[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.