zoukankan      html  css  js  c++  java
  • Centos7 安装Mariadb

    Centos7 安装Mariadb

    1) 安装前查看-了解总结

    Centos7 原生安装了Mariadb, 并且可以看到在/etc/my.cnf文件

    但是不知道如何启动,启动不了
    索性直接删除了安装包,自己重新安装

    2)yum安装Mariadb

    #1) 修改为国内的源
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repo.d/CentOS-Base.repo.backup
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
    #2) 安装mariadb
    yum -y install mariadb mariadb-server mariadb-devel
    

    3) 查看安装后文件目录




    # 启动mariadb并设置开机自启动
    systemctl start mariadb
    systemctl enable mariadb
    # 查看启动
    netstat -ntlp | grep mysql
    

    4) 修改配置文件

    # 修改字符集
    vim /etc/my.cnf
    # [mysql] 下添加如下内容
    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
    vim /etc/my.cnf.d/client.cnf
    # [client] 下添加
    default-character-set=utf8
    vim /etc/my.cnf.d/mysql-clients.cnf
    # [mysqld] 下添加
    default-character-set=utf8
    
    # 重启mariadb
    systemctl restart mariadb
    
    # 开启mariadb客户端
    mysql
    show variables like "character%";
    show variables like "collation%";
    

    5)通过mysql_secure_installation命令 进行安全配置

    # 输入该条命令,按照提示操作
    mysql-secure-installation
    
    # 删除匿名用户,删除test库,设置root的登录密码
    
    # 查看当前用户
    select user()
    # or
    select User,host from mysql.user;
    
    

    6) 改权限root用户可远程登录

    grant all privileges on *.* to 'root'@'%' identified by 'mysql' with grant option;
    flush privileges;
    
    

  • 相关阅读:
    javascript取最小值方法 apply
    c# 通过字符串获取与字符串同名的变量的值
    访问者地图 地址收藏
    自定义Dialog(一)
    android应用多主题
    maven setting 文件
    手动安装cloudera cdh4.2 hadoop + hbase + hive(三)
    手动安装cloudera cdh4.2 hadoop + hbase + hive(一)
    使用Hive读取Hbase中的数据
    手机共享电脑网络
  • 原文地址:https://www.cnblogs.com/persisit/p/13703003.html
Copyright © 2011-2022 走看看