在CentOS7中安装MariaDB所走过的坑10.4.8

因为业务系统性能问题,所以决定将数据库更换为MariaDB尝试一下,先配置了一台作为测试,本以为在CentOS7下用yum安装MariaDB应该和MySQL一样简单。

一、添加yum源

找到官网 https://downloads.mariadb.org/mariadb/repositories/ 按照官方指导添加yum源

# MariaDB 10.4 CentOS repository list - created 2019-10-04 02:50 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

或者用国内镜像

# MariaDB 10.4 CentOS repository list - created 2019-10-04 02:50 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.4/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

然后运行 yum install MariaDB-server MariaDB-client 。

嗯,OK,等待安装完毕。然后运行和启用自动运行:

systemctl start mariadb
systemctl enable mariadb

运行数据库初始化配置,这里按提示就ok

mysql_secure_installation

配置完毕,添加防火墙

firewall-cmd --add-port 3306/tcp --permanent
firewall-cmd --reload

完毕,连接,成功!大功告成!

然而。。。。按照mysql的尿性,默认字符集应该是latin,需要改utf8,(简单:改改配置文件就ok)。so,

第二步,配置文件

2.1步是寻找配置文件,其实在写下这段文字时我依旧不相信这是真的配置文件,我也不知道为什么我的配置文件这么空荡荡的,以下便是我第一次打开配置文件时的内容:

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

然后。。。。。就没有然后了

自己写吧

[mysqld]
datadir=/data/mariadb_data
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
skip-name-resolve

然后保存

反正怎么都可以启动的

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值