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. 大功告成!
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值