网站首页 » 网站运营 » Linux » Centos 7 MariaDB 数据库服务安装及配置
上一篇:
下一篇:

Centos 7 MariaDB 数据库服务安装及配置

小插曲

一开始在网上看到装 mysql 教程,于是就跟着做了,可执行了第一行命令就把错了

# yum install mysql-server

回车后显示如下错误提示

Loaded plugins: fastestmirror
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
rpmforge | 1.9 kB 00:00
updates | 3.4 kB 00:00
updates/7/x86_64/primary_db | 5.7 MB 00:00
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.tuna.tsinghua.edu.cn
* rpmforge: mirrors.neusoft.edu.cn
* updates: mirror.bit.edu.cn
No package mysql-server available.
Error: Nothing to do

No package mysql-server available(找不到安装包),网上一查原来是因为

CentOS 7 版本将 MySQL 数据库软件从默认的程序列表中移除,而用 mariadb 来作为替代器。

MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

那也没办法,我们乖乖地听官方的吧,安装 MariaDB 就好了,下面我们就来一步一个脚印把 MariaDB 拿下。

MariaDB 安装

安装记录

[root@niaoyun53098 /]# yum install mariadb*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.tuna.tsinghua.edu.cn
* rpmforge: mirrors.neusoft.edu.cn
* updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.47-1.el7_2 will be installed
---> Package mariadb-bench.x86_64 1:5.5.47-1.el7_2 will be installed
--> Processing Dependency: perl(GD) for package: 1:mariadb-bench-5.5.47-1.el7_2. x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-bench-5.5.47-1.el7_2 .x86_64
---> Package mariadb-devel.x86_64 1:5.5.47-1.el7_2 will be installed
--> Processing Dependency: openssl-devel(x86-64) for package: 1:mariadb-devel-5. 5.47-1.el7_2.x86_64
---> Package mariadb-embedded.x86_64 1:5.5.47-1.el7_2 will be installed
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 1:mariadb -embedded-5.5.47-1.el7_2.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: 1:mariadb -embedded-5.5.47-1.el7_2.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: 1:mariadb-embedded- 5.5.47-1.el7_2.x86_64
---> Package mariadb-embedded-devel.x86_64 1:5.5.47-1.el7_2 will be installed
---> Package mariadb-libs.x86_64 1:5.5.35-3.el7 will be updated
---> Package mariadb-libs.x86_64 1:5.5.47-1.el7_2 will be an update
---> Package mariadb-server.x86_64 1:5.5.47-1.el7_2 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.47-1 .el7_2.x86_64
---> Package mariadb-test.x86_64 1:5.5.47-1.el7_2 will be installed
--> Processing Dependency: perl(Test::More) for package: 1:mariadb-test-5.5.47-1 .el7_2.x86_64
--> Processing Dependency: perl(Env) for package: 1:mariadb-test-5.5.47-1.el7_2. x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package openssl-devel.x86_64 1:1.0.1e-51.el7_2.5 will be installed
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-51.el7_2.5 for packag e: 1:openssl-devel-1.0.1e-51.el7_2.5.x86_64
--> Processing Dependency: zlib-devel(x86-64) for package: 1:openssl-devel-1.0.1 e-51.el7_2.5.x86_64
--> Processing Dependency: krb5-devel(x86-64) for package: 1:openssl-devel-1.0.1 e-51.el7_2.5.x86_64
---> 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-Env.noarch 0:1.04-2.el7 will be installed
---> Package perl-GD.x86_64 0:2.49-3.el7 will be installed
--> Processing Dependency: gd >= 2.0.28 for package: perl-GD-2.49-3.el7.x86_64
--> Processing Dependency: libgd.so.2()(64bit) for package: perl-GD-2.49-3.el7.x 86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: perl-GD-2.49-3.el7. x86_64
---> Package perl-Test-Simple.noarch 0:0.98-243.el7 will be installed
--> Running transaction check
---> Package gd.x86_64 0:2.0.35-26.el7 will be installed
---> Package krb5-devel.x86_64 0:1.13.2-12.el7_2 will be installed
--> Processing Dependency: krb5-libs(x86-64) = 1.13.2-12.el7_2 for package: krb5 -devel-1.13.2-12.el7_2.x86_64
--> Processing Dependency: libverto-devel for package: krb5-devel-1.13.2-12.el7_ 2.x86_64
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.13.2-12.el 7_2.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.13.2-12.el 7_2.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.13.2-12 .el7_2.x86_64
--> Processing Dependency: libkdb5.so.8()(64bit) for package: krb5-devel-1.13.2- 12.el7_2.x86_64
--> Processing Dependency: libkadm5srv_mit.so.9()(64bit) for package: krb5-devel -1.13.2-12.el7_2.x86_64
---> Package libXpm.x86_64 0:3.5.11-3.el7 will be installed
---> Package openssl-libs.x86_64 1:1.0.1e-34.el7 will be updated
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-34.el7 for package: 1 :openssl-1.0.1e-34.el7.x86_64
---> Package openssl-libs.x86_64 1:1.0.1e-51.el7_2.5 will be an update
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2 020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.202 0-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-1 4.el7.noarch
---> Package zlib-devel.x86_64 0:1.2.7-15.el7 will be installed
--> Processing Dependency: zlib = 1.2.7-15.el7 for package: zlib-devel-1.2.7-15. el7.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
---> Package krb5-libs.x86_64 0:1.11.3-49.el7 will be updated
---> Package krb5-libs.x86_64 0:1.13.2-12.el7_2 will be an update
---> Package libcom_err-devel.x86_64 0:1.42.9-7.el7 will be installed
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-7.el7 for package: libcom _err-devel-1.42.9-7.el7.x86_64
---> Package libselinux-devel.x86_64 0:2.2.2-6.el7 will be installed
--> Processing Dependency: libsepol-devel >= 2.1.9-1 for package: libselinux-dev el-2.2.2-6.el7.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.2 .2-6.el7.x86_64
--> Processing Dependency: pkgconfig(libpcre) for package: libselinux-devel-2.2. 2-6.el7.x86_64
---> Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
---> Package openssl.x86_64 1:1.0.1e-34.el7 will be updated
---> Package openssl.x86_64 1:1.0.1e-51.el7_2.5 will be an update
---> 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
---> Package zlib.x86_64 0:1.2.7-13.el7 will be updated
---> Package zlib.x86_64 0:1.2.7-15.el7 will be an update
--> Running transaction check
---> Package libcom_err.x86_64 0:1.42.9-4.el7 will be updated
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-4.el7 for package: e2fspr ogs-1.42.9-4.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-4.el7 for package: e2fspr ogs-libs-1.42.9-4.el7.x86_64
--> Processing Dependency: libcom_err(x86-64) = 1.42.9-4.el7 for package: libss- 1.42.9-4.el7.x86_64
---> Package libcom_err.x86_64 0:1.42.9-7.el7 will be an update
---> Package libsepol-devel.x86_64 0:2.1.9-3.el7 will be installed
---> Package pcre-devel.x86_64 0:8.32-15.el7_2.1 will be installed
--> Processing Dependency: pcre(x86-64) = 8.32-15.el7_2.1 for package: pcre-deve l-8.32-15.el7_2.1.x86_64
---> 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
--> Running transaction check
---> Package e2fsprogs.x86_64 0:1.42.9-4.el7 will be updated
---> Package e2fsprogs.x86_64 0:1.42.9-7.el7 will be an update
---> Package e2fsprogs-libs.x86_64 0:1.42.9-4.el7 will be updated
---> Package e2fsprogs-libs.x86_64 0:1.42.9-7.el7 will be an update
---> Package libss.x86_64 0:1.42.9-4.el7 will be updated
---> Package libss.x86_64 0:1.42.9-7.el7 will be an update
---> Package pcre.x86_64 0:8.32-12.el7 will be updated
---> Package pcre.x86_64 0:8.32-15.el7_2.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mariadb x86_64 1:5.5.47-1.el7_2 updates 8.9 M
mariadb-bench x86_64 1:5.5.47-1.el7_2 updates 386 k
mariadb-devel x86_64 1:5.5.47-1.el7_2 updates 749 k
mariadb-embedded x86_64 1:5.5.47-1.el7_2 updates 3.6 M
mariadb-embedded-devel x86_64 1:5.5.47-1.el7_2 updates 7.4 M
mariadb-server x86_64 1:5.5.47-1.el7_2 updates 11 M
mariadb-test x86_64 1:5.5.47-1.el7_2 updates 8.0 M
Updating:
mariadb-libs x86_64 1:5.5.47-1.el7_2 updates 755 k
Installing for dependencies:
gd x86_64 2.0.35-26.el7 base 146 k
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.13.2-12.el7_2 updates 649 k
libXpm x86_64 3.5.11-3.el7 base 54 k
libaio x86_64 0.3.109-13.el7 base 24 k
libcom_err-devel x86_64 1.42.9-7.el7 base 30 k
libselinux-devel x86_64 2.2.2-6.el7 base 174 k
libsepol-devel x86_64 2.1.9-3.el7 base 71 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
openssl-devel x86_64 1:1.0.1e-51.el7_2.5 updates 1.2 M
pcre-devel x86_64 8.32-15.el7_2.1 updates 479 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-5.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-Env noarch 1.04-2.el7 base 16 k
perl-GD x86_64 2.49-3.el7 base 173 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
perl-Test-Simple noarch 0.98-243.el7 base 170 k
zlib-devel x86_64 1.2.7-15.el7 base 50 k
Updating for dependencies:
e2fsprogs x86_64 1.42.9-7.el7 base 697 k
e2fsprogs-libs x86_64 1.42.9-7.el7 base 165 k
krb5-libs x86_64 1.13.2-12.el7_2 updates 843 k
libcom_err x86_64 1.42.9-7.el7 base 40 k
libss x86_64 1.42.9-7.el7 base 45 k
openssl x86_64 1:1.0.1e-51.el7_2.5 updates 712 k
openssl-libs x86_64 1:1.0.1e-51.el7_2.5 updates 952 k
pcre x86_64 8.32-15.el7_2.1 updates 420 k
zlib x86_64 1.2.7-15.el7 base 89 k

Transaction Summary
================================================================================
Install 7 Packages (+22 Dependent packages)
Upgrade 1 Package (+ 9 Dependent packages)

Total download size: 49 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/39): e2fsprogs-1.42.9-7.el7.x86_64.rpm | 697 kB 00:00
(2/39): e2fsprogs-libs-1.42.9-7.el7.x86_64.rpm | 165 kB 00:00
(3/39): gd-2.0.35-26.el7.x86_64.rpm | 146 kB 00:00
(4/39): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00
(5/39): libXpm-3.5.11-3.el7.x86_64.rpm | 54 kB 00:00
(6/39): libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00
(7/39): libselinux-devel-2.2.2-6.el7.x86_64.rpm | 174 kB 00:00
(8/39): libsepol-devel-2.1.9-3.el7.x86_64.rpm | 71 kB 00:00
(9/39): libcom_err-devel-1.42.9-7.el7.x86_64.rpm | 30 kB 00:00
(10/39): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00
(11/39): libss-1.42.9-7.el7.x86_64.rpm | 45 kB 00:00
(12/39): libcom_err-1.42.9-7.el7.x86_64.rpm | 40 kB 00:00
(13/39): krb5-devel-1.13.2-12.el7_2.x86_64.rpm | 649 kB 00:00
(14/39): krb5-libs-1.13.2-12.el7_2.x86_64.rpm | 843 kB 00:00
(15/39): mariadb-bench-5.5.47-1.el7_2.x86_64.rpm | 386 kB 00:00
(16/39): mariadb-5.5.47-1.el7_2.x86_64.rpm | 8.9 MB 00:00
(17/39): mariadb-embedded-5.5.47-1.el7_2.x86_64.rpm | 3.6 MB 00:00
(18/39): mariadb-devel-5.5.47-1.el7_2.x86_64.rpm | 749 kB 00:00
(19/39): mariadb-libs-5.5.47-1.el7_2.x86_64.rpm | 755 kB 00:00
(20/39): mariadb-embedded-devel-5.5.47-1.el7_2.x86_64.rpm | 7.4 MB 00:01
(21/39): mariadb-test-5.5.47-1.el7_2.x86_64.rpm | 8.0 MB 00:01
(22/39): openssl-1.0.1e-51.el7_2.5.x86_64.rpm | 712 kB 00:00
(23/39): openssl-devel-1.0.1e-51.el7_2.5.x86_64.rpm | 1.2 MB 00:00
(24/39): openssl-libs-1.0.1e-51.el7_2.5.x86_64.rpm | 952 kB 00:00
(25/39): pcre-8.32-15.el7_2.1.x86_64.rpm | 420 kB 00:00
(26/39): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00
(27/39): pcre-devel-8.32-15.el7_2.1.x86_64.rpm | 479 kB 00:00
(28/39): perl-Env-1.04-2.el7.noarch.rpm | 16 kB 00:00
(29/39): mariadb-server-5.5.47-1.el7_2.x86_64.rpm | 11 MB 00:02
(30/39): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00
(31/39): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00
(32/39): perl-GD-2.49-3.el7.x86_64.rpm | 173 kB 00:00
(33/39): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00
(34/39): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00
(35/39): perl-Test-Simple-0.98-243.el7.noarch.rpm | 170 kB 00:00
(36/39): zlib-1.2.7-15.el7.x86_64.rpm | 89 kB 00:00
(37/39): zlib-devel-1.2.7-15.el7.x86_64.rpm | 50 kB 00:00
(38/39): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm | 140 kB 00:00
(39/39): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00
--------------------------------------------------------------------------------
Total 9.2 MB/s | 49 MB 00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : zlib-1.2.7-15.el7.x86_64 1/49
Updating : libcom_err-1.42.9-7.el7.x86_64 2/49
Updating : krb5-libs-1.13.2-12.el7_2.x86_64 3/49
Updating : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64 4/49
Updating : 1:mariadb-libs-5.5.47-1.el7_2.x86_64 5/49
Installing : 1:mariadb-5.5.47-1.el7_2.x86_64 6/49
Installing : libaio-0.3.109-13.el7.x86_64 7/49
Installing : libXpm-3.5.11-3.el7.x86_64 8/49
Installing : gd-2.0.35-26.el7.x86_64 9/49
Installing : perl-GD-2.49-3.el7.x86_64 10/49
Installing : 1:mariadb-embedded-5.5.47-1.el7_2.x86_64 11/49
Updating : e2fsprogs-libs-1.42.9-7.el7.x86_64 12/49
Updating : libss-1.42.9-7.el7.x86_64 13/49
Installing : libcom_err-devel-1.42.9-7.el7.x86_64 14/49
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 15/49
Installing : zlib-devel-1.2.7-15.el7.x86_64 16/49
Installing : perl-Net-Daemon-0.48-5.el7.noarch 17/49
Updating : pcre-8.32-15.el7_2.1.x86_64 18/49
Installing : pcre-devel-8.32-15.el7_2.1.x86_64 19/49
Installing : libverto-devel-0.2.5-4.el7.x86_64 20/49
Installing : perl-Test-Simple-0.98-243.el7.noarch 21/49
Installing : perl-Env-1.04-2.el7.noarch 22/49
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 23/49
Installing : perl-IO-Compress-2.061-2.el7.noarch 24/49
Installing : perl-PlRPC-0.2020-14.el7.noarch 25/49
Installing : perl-DBI-1.627-4.el7.x86_64 26/49
Installing : perl-DBD-MySQL-4.023-5.el7.x86_64 27/49
Installing : 1:mariadb-server-5.5.47-1.el7_2.x86_64 28/49
Installing : libsepol-devel-2.1.9-3.el7.x86_64 29/49
Installing : libselinux-devel-2.2.2-6.el7.x86_64 30/49
Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 31/49
Installing : krb5-devel-1.13.2-12.el7_2.x86_64 32/49
Installing : 1:openssl-devel-1.0.1e-51.el7_2.5.x86_64 33/49
Installing : 1:mariadb-devel-5.5.47-1.el7_2.x86_64 34/49
Installing : 1:mariadb-embedded-devel-5.5.47-1.el7_2.x86_64 35/49
Installing : 1:mariadb-test-5.5.47-1.el7_2.x86_64 36/49
Installing : 1:mariadb-bench-5.5.47-1.el7_2.x86_64 37/49
Updating : e2fsprogs-1.42.9-7.el7.x86_64 38/49
Updating : 1:openssl-1.0.1e-51.el7_2.5.x86_64 39/49
Cleanup : 1:openssl-1.0.1e-34.el7.x86_64 40/49
Cleanup : e2fsprogs-1.42.9-4.el7.x86_64 41/49
Cleanup : 1:mariadb-libs-5.5.35-3.el7.x86_64 42/49
Cleanup : 1:openssl-libs-1.0.1e-34.el7.x86_64 43/49
Cleanup : krb5-libs-1.11.3-49.el7.x86_64 44/49
Cleanup : e2fsprogs-libs-1.42.9-4.el7.x86_64 45/49
Cleanup : libss-1.42.9-4.el7.x86_64 46/49
Cleanup : libcom_err-1.42.9-4.el7.x86_64 47/49
Cleanup : zlib-1.2.7-13.el7.x86_64 48/49
Cleanup : pcre-8.32-12.el7.x86_64 49/49
Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 1/49
Verifying : libsepol-devel-2.1.9-3.el7.x86_64 2/49
Verifying : perl-IO-Compress-2.061-2.el7.noarch 3/49
Verifying : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64 4/49
Verifying : pcre-devel-8.32-15.el7_2.1.x86_64 5/49
Verifying : 1:mariadb-test-5.5.47-1.el7_2.x86_64 6/49
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 7/49
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 8/49
Verifying : 1:mariadb-5.5.47-1.el7_2.x86_64 9/49
Verifying : perl-Env-1.04-2.el7.noarch 10/49
Verifying : perl-Test-Simple-0.98-243.el7.noarch 11/49
Verifying : perl-GD-2.49-3.el7.x86_64 12/49
Verifying : libverto-devel-0.2.5-4.el7.x86_64 13/49
Verifying : 1:mariadb-embedded-devel-5.5.47-1.el7_2.x86_64 14/49
Verifying : pcre-8.32-15.el7_2.1.x86_64 15/49
Verifying : 1:mariadb-embedded-5.5.47-1.el7_2.x86_64 16/49
Verifying : perl-DBD-MySQL-4.023-5.el7.x86_64 17/49
Verifying : libaio-0.3.109-13.el7.x86_64 18/49
Verifying : e2fsprogs-libs-1.42.9-7.el7.x86_64 19/49
Verifying : zlib-devel-1.2.7-15.el7.x86_64 20/49
Verifying : libselinux-devel-2.2.2-6.el7.x86_64 21/49
Verifying : 1:mariadb-server-5.5.47-1.el7_2.x86_64 22/49
Verifying : zlib-1.2.7-15.el7.x86_64 23/49
Verifying : 1:mariadb-devel-5.5.47-1.el7_2.x86_64 24/49
Verifying : libXpm-3.5.11-3.el7.x86_64 25/49
Verifying : 1:openssl-1.0.1e-51.el7_2.5.x86_64 26/49
Verifying : gd-2.0.35-26.el7.x86_64 27/49
Verifying : libcom_err-1.42.9-7.el7.x86_64 28/49
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 29/49
Verifying : perl-PlRPC-0.2020-14.el7.noarch 30/49
Verifying : krb5-devel-1.13.2-12.el7_2.x86_64 31/49
Verifying : 1:mariadb-bench-5.5.47-1.el7_2.x86_64 32/49
Verifying : perl-DBI-1.627-4.el7.x86_64 33/49
Verifying : libss-1.42.9-7.el7.x86_64 34/49
Verifying : krb5-libs-1.13.2-12.el7_2.x86_64 35/49
Verifying : e2fsprogs-1.42.9-7.el7.x86_64 36/49
Verifying : 1:mariadb-libs-5.5.47-1.el7_2.x86_64 37/49
Verifying : 1:openssl-devel-1.0.1e-51.el7_2.5.x86_64 38/49
Verifying : libcom_err-devel-1.42.9-7.el7.x86_64 39/49
Verifying : e2fsprogs-libs-1.42.9-4.el7.x86_64 40/49
Verifying : e2fsprogs-1.42.9-4.el7.x86_64 41/49
Verifying : 1:mariadb-libs-5.5.35-3.el7.x86_64 42/49
Verifying : pcre-8.32-12.el7.x86_64 43/49
Verifying : zlib-1.2.7-13.el7.x86_64 44/49
Verifying : 1:openssl-1.0.1e-34.el7.x86_64 45/49
Verifying : libss-1.42.9-4.el7.x86_64 46/49
Verifying : 1:openssl-libs-1.0.1e-34.el7.x86_64 47/49
Verifying : libcom_err-1.42.9-4.el7.x86_64 48/49
Verifying : krb5-libs-1.11.3-49.el7.x86_64 49/49

Installed:
mariadb.x86_64 1:5.5.47-1.el7_2
mariadb-bench.x86_64 1:5.5.47-1.el7_2
mariadb-devel.x86_64 1:5.5.47-1.el7_2
mariadb-embedded.x86_64 1:5.5.47-1.el7_2
mariadb-embedded-devel.x86_64 1:5.5.47-1.el7_2
mariadb-server.x86_64 1:5.5.47-1.el7_2
mariadb-test.x86_64 1:5.5.47-1.el7_2

Dependency Installed:
gd.x86_64 0:2.0.35-26.el7
keyutils-libs-devel.x86_64 0:1.5.8-3.el7
krb5-devel.x86_64 0:1.13.2-12.el7_2
libXpm.x86_64 0:3.5.11-3.el7
libaio.x86_64 0:0.3.109-13.el7
libcom_err-devel.x86_64 0:1.42.9-7.el7
libselinux-devel.x86_64 0:2.2.2-6.el7
libsepol-devel.x86_64 0:2.1.9-3.el7
libverto-devel.x86_64 0:0.2.5-4.el7
openssl-devel.x86_64 1:1.0.1e-51.el7_2.5
pcre-devel.x86_64 0:8.32-15.el7_2.1
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-5.el7
perl-DBI.x86_64 0:1.627-4.el7
perl-Env.noarch 0:1.04-2.el7
perl-GD.x86_64 0:2.49-3.el7
perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
perl-Test-Simple.noarch 0:0.98-243.el7
zlib-devel.x86_64 0:1.2.7-15.el7

Updated:
mariadb-libs.x86_64 1:5.5.47-1.el7_2

Dependency Updated:
e2fsprogs.x86_64 0:1.42.9-7.el7 e2fsprogs-libs.x86_64 0:1.42.9-7.el7
krb5-libs.x86_64 0:1.13.2-12.el7_2 libcom_err.x86_64 0:1.42.9-7.el7
libss.x86_64 0:1.42.9-7.el7 openssl.x86_64 1:1.0.1e-51.el7_2.5
openssl-libs.x86_64 1:1.0.1e-51.el7_2.5 pcre.x86_64 0:8.32-15.el7_2.1
zlib.x86_64 0:1.2.7-15.el7

Complete!
[root@niaoyun53098 /]# systemctl start mariadb.service
[root@niaoyun53098 /]# systemctl enable mariadb.service
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user. target.wants/mariadb.service'
[root@niaoyun53098 /]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit
Bye

上面的是显示的是安装 mariadb 的全过程,如果你有密集恐惧证,那也不用担心,我们在 MariaDB 在安装过程中使用到的命令整理出来。

安装详情

# yum install mariadb*

在安装过程中会你遇到

Is this ok [y/d/N]:

输入y就可以了,直到 Complete!你都不用动手了。安装完后,你只需要作一些简单的配置就行。

配置 MariaDB

开启 MariaDB 数据库服务

# systemctl start mariadb.service

服务器开机或重启时自动开启 MariaDB 数据库服务

# systemctl enable mariadb.service

MariaDB数据库管理

# mysql

现在就可以进行数据库的管理了,享受你的旅程吧!

MariaDB 安全配置

配置记录

修改默认的数据用户密码(安装完之后,数据库用户密码默认是空的),我们执行下面命令行进行修改

# mysql_secure_installation

输入后会有如下一些信息及操作提示。我一直按 y 可以了。

[root@niaoyun53098 ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

配置详情

如果你有密集恐惧症,你也不用担心,下面我就把配置化繁为简,把你需要你操作的步骤精炼出来,这样你就可以看得一清二楚了。
当你输入# mysql_secure_installation回车后,首先会遇到如下提示:

Enter current password for root (enter for none): 
//输入当前的 root 用户密码

注意这里的 root 用户与你登录系统那个 root 用户是不一样的,安装完后的 MariaDB 数据库有一个默认的用户 root 并且它的密码为空,所以这里我们直接按回车键就可以。

接下来你就只要你遇到下面这些提示一直按y就可以了

Set root password? [Y/n]

//是否要设置root 用户的密码?

Remove anonymous users? [Y/n] y

//删除匿名用户?

Disallow root login remotely? [Y/n] y

//不允许远程登录?

Remove test database and access to it? [Y/n] y

//删除测试数据库?

Reload privilege tables now? [Y/n] y

现在是否重新加载权限?

这样一步一步完成之后,MariaDB 数据库就算大功告成了。现在你就可以心情使用它了。

进入数据库

show databases
  • 微信扫一扫,赏我

  • 支付宝扫一扫,赏我

声明

原创文章,不经本站同意,不得以任何形式转载,如有不便,请多多包涵!

本文永久链接:http://yunkus.com/centos7-mariadb-database-service-install-config/

Leave a Reply

Your email address will not be published. Required fields are marked *

评论 END