---
title: "Centos 安装mariadb"
author: "cooperay"
date: "2016-07-19T23:02:11Z"
tags: []
categories: ["操作系统"]
slug: "centos-mariadb"
draft: false
lastmod: "2016-07-19T23:12:24Z"
id: 2312269
url: "https://cooperay.iteye.com/blog/2312269"
---

从最新版本的linux系统开始，默认的是 Mariadb而不是mysql！

使用系统自带的repos安装很简单：

1、安装 

yum install mariadb mariadb-server

systemctl start mariadb ==&gt; 启动mariadb

systemctl enable mariadb ==&gt; 开机自启动

mysql\_secure\_installation ==&gt; 设置 root密码等相关

mysql -uroot -p123456 ==&gt; 测试登录！

结束！

2、授权远程访问

     第一改表

      update user set host='%' where user = 'root';

      select host,user from user;

     第二授权

     GRANT   ALL   PRIVILEGES   ON   \*.*   TO   ['root'@'%'](mailto:'root'@'%')   WITH   GRANT   OPTION;   授权所有主机访问

     FLUSH   PRIVILEGES; 保存更改

     exit;  退出