CentOS 7 安装 MariaDB MariaDB-Server(MySQL)数据库实例

[root@hexingxing]# yum -y install mariadb mariadb-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
软件包 1:mariadb-5.5.56-2.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb-server.x86_64.1.5.5.56-2.el7 将被 安装
--> 正在处理依赖关系 perl-DBI,它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要
--> 正在处理依赖关系 perl-DBD-MySQL,它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(Data::Dumper),它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要
--> 正在处理依赖关系 perl(DBI),它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 perl-DBD-MySQL.x86_64.0.4.023-5.el7 将被 安装
---> 软件包 perl-DBI.x86_64.0.1.627-4.el7 将被 安装
--> 正在处理依赖关系 perl(RPC::PlServer) >= 0.2001,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
--> 正在处理依赖关系 perl(RPC::PlClient) >= 0.2000,它被软件包 perl-DBI-1.627-4.el7.x86_64 需要
---> 软件包 perl-Data-Dumper.x86_64.0.2.145-3.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-PlRPC.noarch.0.0.2020-14.el7 将被 安装
--> 正在处理依赖关系 perl(Net::Daemon) >= 0.13,它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Test),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Net::Daemon::Log),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Zlib),它被软件包 perl-PlRPC-0.2020-14.el7.noarch 需要
--> 正在检查事务
---> 软件包 perl-IO-Compress.noarch.0.2.061-2.el7 将被 安装
--> 正在处理依赖关系 perl(Compress::Raw::Zlib) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
--> 正在处理依赖关系 perl(Compress::Raw::Bzip2) >= 2.061,它被软件包 perl-IO-Compress-2.061-2.el7.noarch 需要
---> 软件包 perl-Net-Daemon.noarch.0.0.48-5.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Compress-Raw-Bzip2.x86_64.0.2.061-3.el7 将被 安装
---> 软件包 perl-Compress-Raw-Zlib.x86_64.1.2.061-4.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================
 Package                            架构                   版本                      源                      大小
=================================================================================================================
正在安装:
 mariadb-server                      x86_64                1:5.5.56-2.el7            base                    11 M
为依赖而安装:
 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-Data-Dumper                    x86_64                2.145-3.el7               base                    47 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

事务概要
==================================================================================================================
安装  1 软件包 (+8 依赖软件包)

总下载量:13 M
安装大小:62 M
Downloading packages:
(1/9): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                                          |  32 kB  00:00:00     
(2/9): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                 |  47 kB  00:00:00     
(3/9): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                                           |  57 kB  00:00:00     
(4/9): perl-IO-Compress-2.061-2.el7.noarch.rpm                                                 | 260 kB  00:00:00     
(5/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                   |  51 kB  00:00:00     
(6/9): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm                                                   | 140 kB  00:00:00     
(7/9): perl-PlRPC-0.2020-14.el7.noarch.rpm                                                     |  36 kB  00:00:00     
(8/9): mariadb-server-5.5.56-2.el7.x86_64.rpm                                                  |  11 MB  00:00:01     
(9/9): perl-DBI-1.627-4.el7.x86_64.rpm                                                         | 802 kB  00:00:01     
-------------------------------------------------------------------------------------------------------------------
总计                                                                                  9.0 MB/s |  13 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : perl-Data-Dumper-2.145-3.el7.x86_64                                                  1/9 
  正在安装    : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                           2/9 
  正在安装    : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                          3/9 
  正在安装    : perl-IO-Compress-2.061-2.el7.noarch                                                  4/9 
  正在安装    : perl-Net-Daemon-0.48-5.el7.noarch                                                    5/9 
  正在安装    : perl-PlRPC-0.2020-14.el7.noarch                                                      6/9 
  正在安装    : perl-DBI-1.627-4.el7.x86_64                                                          7/9 
  正在安装    : perl-DBD-MySQL-4.023-5.el7.x86_64                                                    8/9 
  正在安装    : 1:mariadb-server-5.5.56-2.el7.x86_64                                                 9/9 
  验证中      : perl-DBI-1.627-4.el7.x86_64                                                          1/9 
  验证中      : perl-Net-Daemon-0.48-5.el7.noarch                                                    2/9 
  验证中      : perl-Data-Dumper-2.145-3.el7.x86_64                                                  3/9 
  验证中      : perl-PlRPC-0.2020-14.el7.noarch                                                      4/9 
  验证中      : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                          5/9 
  验证中      : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                           6/9 
  验证中      : 1:mariadb-server-5.5.56-2.el7.x86_64                                                 7/9 
  验证中      : perl-IO-Compress-2.061-2.el7.noarch                                                  8/9 
  验证中      : perl-DBD-MySQL-4.023-5.el7.x86_64                                                    9/9 

已安装:
  mariadb-server.x86_64 1:5.5.56-2.el7                                                                                               

作为依赖被安装:
  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-Data-Dumper.x86_64 0:2.145-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           

完毕!
[root@hexingxing]# systemctl start mariadb # 安装完成MariaDB,首先启动MariaDB
[root@hexingxing]# systemctl enable mariadb # 设置开机启动
[root@hexingxing]# mysql_secure_installation # 进行MariaDB的相关简单配置

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 # 是否设置root用户密码,输入y并回车或直接回车
New password: # 设置root用户的密码
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 # 是否禁止root远程登录, 回车
 ... 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 # 是否删除test数据库,回车
 - 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!
[root@hexingxing]# mysql -uroot -p # 测试登录
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.56-MariaDB MariaDB Server

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

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

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

0 条评论

昵称

沙发空缺中,还不快抢~