Step 1:
新建repo文件
touch /etc/yum.repos.d/MariaDB.repo
官方源
[mariadb]
name = MariaDB-10.3.9
baseurl=http://yum.mariadb.org/10.3.9/centos7-amd64
# alternative: baseurl=http://archive.mariadb.org/mariadb-10.3.9/yum/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
中科大源
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.1/centos7-amd64/
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
导入GPG
rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Step 2:
安装Mariadb数据库
[root@YunDisk Exdisk]# yum install mariadb mariadb-server
Step 3:
设置MariaDB
- 启动MariaDB
[root@YunDisk Exdisk]# systemctl start mariadb
- 停止MariaDB
[root@YunDisk Exdisk]# systemctl stop mariadb
- 设置开机启动
[root@YunDisk Exdisk]# systemctl enable mariadb
- 拷贝配置文件
[root@YunDisk Exdisk]# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
Step 4:
修改数据库为UTF8(支持中文)
[root@YunDisk Exdisk]# vim /etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
Step 5:
再次启动MariaDB
[root@YunDisk Exdisk]# systemctl start mariadb
Step 6:
设置密码
[root@YunDisk Seafile]# mysql -uroot -p
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set password=PASSWORD(‘123456‘) where user="root";
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> quit