CentOS 7 安装 MariaDB 10.1

CentOS 7 安装 MariaDB 10.1

使用认的yum install mariadb-server时,认安装的是和MysqL相兼容的5.5版本。想安装Mariadb 10.1或以上版本,必须先指定yum源。


  1. 使用源配置向导

    https://downloads.mariadb.org/mariadb/repositories

    可以选择合适的操作系统和想要安装的MariaDB版本,然后自动生成源配置。

  2. 我使用的是:

    # MariaDB 10.1 CentOS repository list - created 2016-05-12 09:28 UTC
     # http://mariadb.org/mariadb/repositories/
     [mariadb]
     name = MariaDB
     baseurl = http://yum.mariadb.org/10.1/centos7-amd64
     gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
     gpgcheck=1
  3. 配置yum源

    /etc/yum.repos.d/
    touch MariaDB.repo
    vim MariaDB.repo

    将上面的内容复制进去,保存退出

  4. 安装MariaDB 10.1

    yum install MariaDB-server MariaDB-client

    如果出现了MariaDB can’t be installed because of conflict with mariadb-libs-xxxx,则需要先卸载当前安装的版本:

    yum remove mariadb-libs*

    安装完成后,会提示你为root设置密码,此时需要先运行Mariadb。

  5. 运行 MariaDB

    service MysqL start

    输出

    Starting MysqL (via systemctl): [ OK ]

  6. 配置 MariaDB

    MysqL_secure_installation

    如果出现error: 'Can't connect to local MysqL server through socket '/var/lib/MysqL/MysqL.sock' (2 "No such file or directory")',则说明mariadb没有启动,需要先运行Mariadb,参考第5步。

    Enter current password for root (enter for none):  输入当前的root密码(认空),直接回车
     Set root password? [Y/n] 设置新密码,y
     Remove anonymous users? [Y/n] 移除匿名用户,y
     disallow root login remotely? [Y/n] 禁止root用户远程登录,y
     Remove test database and access to it? [Y/n] 移除测试数据库,y
     Reload privilege tables Now? [Y/n] y
  7. 配置
    MysqL在Linux上认是表名大小写敏感的,需要手动配置才能使之忽略大小写:

    vim vim /etc/my.cnf

    [MysqLd]下,修改(没有则添加):

    lower_case_table_names=1

    然后重启MysqL服务

    service MysqL restart

  1. 大功告成!

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native