1、下载相关包
- jemalloc-3.6.0-1.el7.x86_64.rpm
- MariaDB-10.1.21-centos7-x86_64-client.rpm
- MariaDB-10.1.21-centos7-x86_64-compat.rpm
- galera-25.3.19-1.rhel7.el7.centos.x86_64.rpm
- jemalloc-devel-3.6.0-1.el7.x86_64.rpm
- MariaDB-10.1.21-centos7-x86_64-common.rpm
- MariaDB-10.1.21-centos7-x86_64-server.rpm
2、First install all of the dependencies needed. Its easy to do this via YUM packages
yum install rsync nmap lsof perl-DBI nc
3、安装 jemalloc-3.6.0-1.el7.x86_64.rpm
rpm -ivh jemalloc-3.6.0-1.el7.x86_64.rpm
4、安装jemalloc-devel-3.6.0-1.el7.x86_64.rpm
rpm -ivh jemalloc-devel-3.6.0-1.el7.x86_64.rpm
5、查找、卸载已经安装的冲突包
# rpm -qa | grep mariadb-libs mariadb-libs-5.5.52-1.el7.x86_64 # rpm -ev --nodeps mariadb-libs-5.5.52-1.el7.x86_64 Preparing packages... mariadb-libs-1:5.5.52-1.el7.x86_64
6、安装依赖包
yum install boost-devel.x86_64
7、导入key
#rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB
8、安装剩下相关包
rpm -ivh MariaDB-10.1.21-centos7-x86_64-common.rpm
MariaDB-10.1.21-centos7-x86_64-compat.rpm
MariaDB-10.1.21-centos7-x86_64-client.rpm
galera-25.3.19-1.rhel7.el7.centos.x86_64.rpm
MariaDB-10.1.21-centos7-x86_64-server.rpm
9、启动数据库
service mysql start
10、进行安全配置
mysql_secure_installation
配置过程提示选项:
1、输入当前密码,初次安装后没有密码,直接回车;
2、询问是否使用’unix_socket'进行身份验证:n;
3、为root用户设置密码:y;
4、输入root用户新密码,再次确认密码;
5、是否移除匿名用户,这个随意,建议删除:y;
6、拒绝用户远程登录,建议开启:n;
7、删除test库,可以保留,n;
8、重新加载权限表库:y;
当看到 Thanks for using MariaDB!这句话表示成功
11、赋予远程登录权限
登入数据库 mysql -u root -p 输入密码***** 赋予root远程登录权限 grant all privileges on *.* to 'root'@'%' identifyied by 'root密码‘; 刷新 flush privileges;
参考文献:https://mariadb.com/kb/en/mariadb-installation-version-10121-via-rpms-on-centos-7/