CentOS7安装MariaDB

MariaDB,它全面兼容了Mysql

注意:Mysql8有些字符集编码,MariaDB不支持,参考网上改了好久仍然有错,所以后来我又卸载改回Mysql了

安装

  • 数据包

    链接:https://pan.baidu.com/s/1-OkqhVD4yEh4JU-4k8nGZQ 提取码:e3ms

    官网原地址 http://yum.mariadb.org/10.4/centos7-amd64/rpms/

    //三个命令安装依赖的环境包
    #yum install rsync nmap lsof perl-DBI nc
    ​
    #rpm -ivh jemalloc-3.6.0-1.el7.x86_64.rpm
    ​
    #rpm -ivh jemalloc-devel-3.6.0-1.el7.x86_64.rpm
    ​
    //检查有没有mariadb-libs-5.5.65-1.el7.x86_64,有的话删掉
    #rpm -qa | grep mariadb-libs
    //删除
    #rpm -ev --nodeps mariadb-libs-5.5.65-1.el7.x86_64
    //再检查一遍
    #rpm -qa | grep mariadb-libs
    ​
    //galera环境
    #yum install boost-devel.x86_64
    //解决上一个install出现的warning
    #rpm --import http://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    ​
    //安装5个包
    #rpm -ivh MariaDB-common-10.4.17-1.el7.centos.x86_64.rpm MariaDB-compat-10.4.17-1.el7.centos.x86_64.rpm MariaDB-client-10.4.17-1.el7.centos.x86_64.rpm galera-4-26.4.4-1.rhel7.el7.centos.x86_64.rpm MariaDB-server-10.4.17-1.el7.centos.x86_64.rpm
    ​

配置

//启动
  //service mysql start不好使了,参考
  //https://blog.csdn.net/qq_38286347/article/details/85060407?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2.not_use_machine_learn_pai&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-2.not_use_machine_learn_pai
  ​
  //第一步,启动服务
  # systemctl start mariadb.service //启动服务
  ​
  //加入开机服务
  # systemctl enable mariadb.service //开机启动服务
  ​
  //打开安全配置
  # mysql_secure_installation 
  ​
  //输入当前的密码,不过现在还没有密码,提示后,直接回车
  //弹出,switch to unix_socket authentication[y/n]
  #n
  //change the root password?[y/n]
  #y
  输入密码123456
  //remove anonymous users?[y/n]
  #y
  //Disallow root login remotely?[y/n]
  #n
  //remove test database and access to it?[y/n]
  #y
  //reload privilege tables now?[y/n]
  #y
  //thanks for using MariaDB--安装成功了

远程连接配置

    //登录,进入mysql命令行
    #mysql -u root -p
    ​
    //赋予用户远程连接的权限
    #grant all privileges on *.* to 'root'@'%' identified by 'root密码';
    #flush privileges;

你可能感兴趣的:(CentOS7安装MariaDB)