前言

MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB来代替MySQL的InnoDB。 MariaDB由MySQL的创始人Michael Widenius主导开发,MariaDB名称来自Michael Widenius的女儿Maria的名字

Linux安装MariaDB

安装

使用yum安装MariaDB

yum install mariadb*



安装完成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 -u root -p
Enter password:

配置

配置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查看字符集

mysql> show variables like "%character%";show variables like "%collation%";

显示为

+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec) +----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)

字符集配置完成。

添加用户,设置权限

创建用户命令

mysql>create user username@localhost identified by 'password';

直接创建用户并授权的命令

mysql>grant all on *.* to username@localhost indentified by 'password';

授予外网登陆权限

mysql>grant all privileges on *.* to username@'%' identified by 'password';

授予权限并且可以授权

mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;

简单的用户和权限配置基本就这样了。

其中只授予部分权限把其中all privileges或者all改为select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file其中一部分。

参考

Linux系统教程:如何检查MariaDB服务端版本 http://www.linuxidc.com/Linux/2015-08/122382.htm

MariaDB Proxy读写分离的实现 http://www.linuxidc.com/Linux/2014-05/101306.htm

Linux下编译安装配置MariaDB数据库的方法 http://www.linuxidc.com/Linux/2014-11/109049.htm

CentOS系统使用yum安装MariaDB数据库 http://www.linuxidc.com/Linux/2014-11/109048.htm

安装MariaDB与MySQL并存 http://www.linuxidc.com/Linux/2014-11/109047.htm

Ubuntu 上如何将 MySQL 5.5 数据库迁移到 MariaDB 10 http://www.linuxidc.com/Linux/2014-11/109471.htm

[翻译]Ubuntu 14.04 (Trusty) Server 安装 MariaDB http://www.linuxidc.com/Linux/2014-12/110048.htm

CentOS7下MariaDB数据库安装及配置的更多相关文章

  1. centos7下postgresql数据库安装及配置

    1.安装 #yum install -y postgresql-server 2.postgresql数据库初始化 #service postgresql initdb 3.启动postgresql服 ...

  2. Centos7 下的SVN安装与配置

    Centos7 下的SVN安装与配置 1.关闭防火墙 临时关闭防火墙 systemctl stop firewalld 永久防火墙开机自关闭 systemctl disable firewalld 临 ...

  3. CentOS7下NFS服务安装及配置固定端口

    CentOS7下NFS服务安装及配置 系统环境:CentOS Linux release 7.4.1708 (Core) 3.10.0-693.el7.x86_64 软件版本:nfs-utils-1. ...

  4. centOS7中Mariadb数据库安装与基本管理

    一.Mariadb数据库安装 1. 直接yum源安装 yum -y install mariadb mariadb-serversystemctl start mariadb /启动Mariadb服务 ...

  5. centos7下git的安装和配置

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  6. Windows下MariaDB数据库安装图文教程

    MariaDB是基于MySQL的开源数据库,兼容MySQL,现有的MySQL数据库可以迁移到MariaDB中使用   说明: MariaDB是基于MySQL的开源数据库,兼容MySQL,现有的MySQ ...

  7. Centos7下nginx的安装与配置

    说明:软件安装的基础目录路径:/usr/local 所以下载软件的时候切换到此目录下下载直接解压即可 1.安装gcc gcc-c++依赖包 yum install -y gcc gcc-c++ 2.下 ...

  8. Centos7下oracle12c的安装与配置(详细)

    一.硬件配置 CentOS7@VMware® Workstation 15 Pro,分配资源:CPU:2颗,内存:4GB,硬盘空间:30GB 二.软件准备  linux.x64_11gR2_datab ...

  9. Win下 MySQL数据库安装与配置详解

    第一步 从官网下载安装包 (本次只写安装版的32位的mysql) 1. https://www.mysql.com/downloads/ 下载的官网地址 一直滑到最下面 然后点第一个 然后选第一个 这 ...

随机推荐

  1. 对象浅拷贝Object.assign

    const target = { a: { b: { c: { d: 1 } }, e: 5, f: 6, h: 10 } } const source = { a: { b: { c: { d: 1 ...

  2. 修改Ubuntu的apt-get源为国内镜像源的方法

    1.原文件备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 2.编辑源列表文件 sudo vim /etc/apt/sources. ...

  3. Spark学习之路 (八)SparkCore的调优之开发调优[转]

    前言 在大数据计算领域,Spark已经成为了越来越流行.越来越受欢迎的计算平台之一.Spark的功能涵盖了大数据领域的离线批处理.SQL类处理.流式/实时计算.机器学习.图计算等各种不同类型的计算操作 ...

  4. #4864. [BeiJing 2017 Wc]神秘物质 [FHQ Treap]

    这题其实挺简单的,有个东西可能稍微难维护了一点点.. \(merge\ x\ e\) 当前第 \(x\) 个原子和第 \(x+1\) 个原子合并,得到能量为 \(e\) 的新原子: \(insert\ ...

  5. BugkuCTF flag.php(反序列化)

    进去后是个登录页面,但是login根本不会跳转,看源码也没提示,但是这道题给了一个提示:hint,那么盲猜应该是一个get参数,因为post不能跳转,那么get总有内容吧,跟上hint参数,随便赋一个 ...

  6. Qt Gui 第八章

    一.QGradient 该类是渐变画刷相关的类,有三个子类,分别是QConicalGradient.QRadialGradient和QLinearGradient 1.QConicalGradient ...

  7. Ioc依赖注入:Unity4.0.1 在项目中的应用 (MVC和API)

    使用Unity的好处网上有很多,百度一下即可 这里引用了一篇关于面向接口编程的好处的文章作为引申:https://blog.csdn.net/Cyy19970527/article/details/8 ...

  8. Jmeter-第三方插件安装

    1.插件下载 官方地址https://jmeter-plugins.org/install/Install/ 网盘地址链接: https://pan.baidu.com/s/1E4lnMWDGPWCN ...

  9. 在阿里云IIS服务器上安装证书

    在IIS服务器上安装证书 您可将下载的阿里云SSL证书安装到IIS服务器上,使您的IIS服务器支持HTTPS安全访问. 一.前提条件 申请证书时需要选择 系统自动创建CSR. 申请证书时如果选择手动创 ...

  10. The Softmax function and its derivative

    https://eli.thegreenplace.net/2016/the-softmax-function-and-its-derivative/  Eli Bendersky's website ...