centos 7 mariadb安装

1、安装MariaDB

安装命令

yum -y install mariadb mariadb-server

安装完成MariaDB,首先启动MariaDB

systemctl start mariadb

设置开机启动

systemctl enable mariadb

接下来进行MariaDB的相关简单配置

mysql_secure_installation

首先是设置密码,会提示先输入密码

Enter current password for root (enter for none):<–初次运行直接回车

设置密码

Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码

其他配置

Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车

Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,

Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车

Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车

初始化MariaDB完成,接下来测试登录

mysql -uroot -ppassword

完成。

[root@localhost ~]# rpm -qa | grep mysql

[root@localhost ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@localhost ~]# find / -name mariadb-libs-5.5.56-2.el7.x86_64
find: ‘/run/user/1000/gvfs’: 权限不够
[root@localhost ~]# find . -name mariadb-libs-5.5.56-2.el7.x86_64
[root@localhost ~]# 
[root@localhost ~]# yum -y install mariadb mariadb-server
已加载插件:fastestmirror, langpacks
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
base | 3.6 kB 00:00:00 
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
extras | 3.4 kB 00:00:00 
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
updates | 3.4 kB 00:00:00 
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.56-2.el7 将被 安装
---> 软件包 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 x86_64 1:5.5.56-2.el7 base 8.7 M
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

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

总下载量:21 M
安装大小:110 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/mariadb-server-5.5.56-2.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
mariadb-server-5.5.56-2.el7.x86_64.rpm 的公钥尚未安装
(1/10): mariadb-server-5.5.56-2.el7.x86_64.rpm | 11 MB 00:00:02 
(2/10): mariadb-5.5.56-2.el7.x86_64.rpm | 8.7 MB 00:00:02 
(3/10): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00 
(4/10): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00 
(5/10): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm | 140 kB 00:00:00 
(6/10): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00 
(7/10): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00 
(8/10): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00 
(9/10): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00 
(10/10): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00 
----------------------------------------------------------------------------------------
总计 8.1 MB/s | 21 MB 00:02 
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
软件包 : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : perl-Data-Dumper-2.145-3.el7.x86_64 1/10 
正在安装 : 1:mariadb-5.5.56-2.el7.x86_64 2/10 
正在安装 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 3/10 
正在安装 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 4/10 
正在安装 : perl-IO-Compress-2.061-2.el7.noarch 5/10 
正在安装 : perl-Net-Daemon-0.48-5.el7.noarch 6/10 
正在安装 : perl-PlRPC-0.2020-14.el7.noarch 7/10 
正在安装 : perl-DBI-1.627-4.el7.x86_64 8/10 
正在安装 : perl-DBD-MySQL-4.023-5.el7.x86_64 9/10 
正在安装 : 1:mariadb-server-5.5.56-2.el7.x86_64 10/10 
验证中 : perl-DBI-1.627-4.el7.x86_64 1/10 
验证中 : perl-Net-Daemon-0.48-5.el7.noarch 2/10 
验证中 : perl-Data-Dumper-2.145-3.el7.x86_64 3/10 
验证中 : perl-PlRPC-0.2020-14.el7.noarch 4/10 
验证中 : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 5/10 
验证中 : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 6/10 
验证中 : 1:mariadb-server-5.5.56-2.el7.x86_64 7/10 
验证中 : perl-IO-Compress-2.061-2.el7.noarch 8/10 
验证中 : perl-DBD-MySQL-4.023-5.el7.x86_64 9/10 
验证中 : 1:mariadb-5.5.56-2.el7.x86_64 10/10

已安装:
mariadb.x86_64 1:5.5.56-2.el7 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@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl enable maiadb
Failed to execute operation: No such file or directory
[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# mysql_secure_installation

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] 
... 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] 
- 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] 
... 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@localhost ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
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)]>

2、配置MariaDB的字符集

文件/etc/my.cnf

vi /etc/my.cnf

在[mysqld]标签下添加

init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

文件/etc/my.cnf.d/client.cnf

vi /etc/my.cnf.d/client.cnf

在[client]中添加

default-character-set=utf8

文件/etc/my.cnf.d/mysql-clients.cnf

vi /etc/my.cnf.d/mysql-clients.cnf

在[mysql]中添加

default-character-set=utf8

全部配置完成,重启mariadb

systemctl restart mariadb

之后进入MariaDB查看字符集

[root@localhost ~]# mysql -u root -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 variables like "%character%";show variables like "%collation%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)

+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)

centos 7 mariadb安装的更多相关文章

  1. centos 7 mariadb 安装

    yum install -y mariadb mariadb-server systemctl start mariadb systemctl enable mariadb #初始化 mysql_se ...

  2. CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止fir ...

  3. CentOS 7 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)

    原文 CentOS 7 下安装 LEMP 服务(nginx.MariaDB/MySQL 和 php) LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作 ...

  4. CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)(转)

    转自:http://www.jb51.net/os/188488.html 作者:佚名 字体:[增加 减小] 来源:osyunwei  准备篇: CentOS 7.0系统安装配置图解教程 http:/ ...

  5. CentOS通过yum安装MariaDB(MySQL)无法启动服务或者找不到mysql.sock

    转载自:http://www.linuxidc.com/Linux/2016-03/129396.htm 今天在Linux主机(CentOS 7)安装(yum install方式)Mariadb(即开 ...

  6. CentOS 7下安装配置搭建jdk+tomcat+MariaDB环境

    1.JDK安装 注意:rpm与软件相关命令 相当于window下的软件助手 管理软件 步骤: 1)查看当前Linux系统是否已经安装java 输入 rpm -qa | grep java 2)卸载两个 ...

  7. Centos 7.0 安装Mono 3.4 和 Jexus 5.6

    2013-07-26 写过一篇<CentOS 6.3下 安装 Mono 3.2 和Jexus 5.4>,CentOS 7在CentOS 6的基础上有很大的调整,本文是这篇文章的更新,主要介 ...

  8. Mysql的基础使用之MariaDB安装

    初学mysql的小白,首次写博客,为了能让自己记得更加深刻,也是以一种小白的角度交代初学者的经历和困难,也算是记录自己成长的步伐吧 我首次用mysql是在ubuntu上 ,现在用的是linux 中的R ...

  9. 如何在CentOS 7上安装Percona服务器

    在这篇文章中我们将了解关于 Percona 服务器,一个开源的MySQL,MariaDB的替代品.InnoDB的数据库引擎使得Percona 服务器非常有吸引力,如果你需要的高性能,高可靠性和高性价比 ...

随机推荐

  1. EXCEL公式及宏

    VLOOKUP特别好用的一个用于映射的公式 1.需要根据ID找到对应的NAME 2.将可以用于映射的两列放到G,H列中(注意!用于检索的要放在相对的第一列中) 3.VLOOKUP(A2,G:H,2,F ...

  2. C++ STL库的总结以及实现原理

    STL的容器可以分为以下几个大类:一:序列容器, 有vector, list, deque, string. 二 : 关联容器,     有set, multiset, map, mulmap has ...

  3. CCS中CMD文件解析

    http://blog.csdn.net/u011392772/article/details/49760897 gel文件中主要包含了PLL.DDR等的初始化工作,具体可以看一下gel源码就明白了: ...

  4. Maven引入自定义jar包

    1.将项目打成jar包  或者下载某个jar包  放在某个目录下(随便吧,桌面也行),这里是放在F:/  jar包为 alipay.jar 2.给jar包取个名字   用原名也行(maven打包默认会 ...

  5. python的语法小结之生成器和迭代器

    生成器: 首先介绍一下列表生成式:a=[x for x in range(10)]               >>>>>>[0, 1, 2, 3, 4, 5, 6 ...

  6. 4yue 22

    1 # 1 . 进程 线程 协程 之间的相同点和不同点 #相同点:都能帮助我们实现并发操作,规避IO时间,提高执行效率 #进程:内存隔离 操作系统级别 可以利用多核(高计算) 计算机中资源分配的最小单 ...

  7. Meanshift均值漂移算法

      通俗理解Meanshift均值漂移算法  Meanshift车手?? 漂移?? 秋名山???   不,不,他是一组算法,  今天我就带大家来了解一下机器学习中的Meanshift均值漂移. Mea ...

  8. nginx高级用法汇总

    1,nginx限制IP访问,允许IP访问 1.1 模块:nginx_http_access_module 注意:检测顺序是按配置顺序进行的,匹配首条规则将会被使用,所以要注意在配置文件配置的顺序. a ...

  9. HTML的Tomcat

    修改D:\software\apache-tomcat-8.0.44\webapps\ROOT\WEB-INF\web.xml: <?xml version="1.0" en ...

  10. 2019.03.26 bzoj4448: [Scoi2015]情报传递(归并排序+树链剖分)

    传送门 题意简述: 给一棵nnn个点的树,树上每个点表示一个情报员,一共有mmm天,每天会派发以下两种任务中的一个任务: 1.搜集情报:指派T号情报员搜集情报 2.传递情报:将一条情报从X号情报员传递 ...