zoukankan      html  css  js  c++  java
  • linux下安装mysql(mariadb)

    yum安装软件(官网很慢)

    yum install  mariadb  发现版本如下,版本特别低,且安装包特别小,
        
        mariadb                        x86_64                   1:5.5.60-1.el7_5                   base                   8.9 M
        
        2.我们可以配置mariadb官方的yum源(官方的mariadb包一定是最新的,最好的,功能最全的,但是下载速度可能很慢)
        配置官方mariadb的yum源步骤
        1.新建一个yum源仓库
            touch /etc/yum.repos.d/Mariadb.repo 
        2.在这个yum源仓库文件中,添加仓库url地址
            [mariadb]
            name = MariaDB
            baseurl = http://yum.mariadb.org/10.1/centos7-amd64
            gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
            gpgcheck=1
            
        3.一条命令安装mariadb
        yum install MariaDB-server MariaDB-client -y

    由于官方的下载网速忒慢了,我们学习使用阿里云的mariadb数据库!!

    重命名这个Mariadb.repo文件

    mv /etc/yum.repos.d/Mariadb.repo  /etc/yum.repos.d/Mariadb.repo.bak 

    使用阿里云的mariadb

    yum install mariadb-server mariadb -y  

    启动mariadb数据库

    systemctl   start/stop/status/restart    mariadb 

    初始化数据库

    mysql_secure_installation

    登录数据库

    mysql -uroot -p 

    设置mariadb数据库支持中文

    vim /etc/my.cnf
    [mysqld]
    character-set-server=utf8
    collation-server=utf8_general_ci
    log-error=/var/log/mysqld.log
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    # Settings user and group are ignored when systemd is used.
    # If you need to run mysqld under a different user or group,
    # customize your systemd unit file for mariadb according to the
    # instructions in http://fedoraproject.org/wiki/Systemd
    [client]
    default-character-set=utf8
    [mysql]
    default-character-set=utf8
    [mysqld_safe]
    log-error=/var/log/mariadb/mariadb.log
    pid-file=/var/run/mariadb/mariadb.pid
    
    #
    # include all files from the config directory
    #
    !includedir /etc/my.cnf.d

    重启数据库服务

    systemctl restart mariadb 

    登录新的数据库,查看中文编码设置

    MariaDB [(none)]> s
    10.查看数据库的编码设置,以及表的设置
        show create database qishi1;
        show create  table   shenqu;
  • 相关阅读:
    [转帖]Javascript字符验证代码
    HTML标签转换函数
    [转帖]javascript做浮点数运算精确问题
    页面间参数传递
    js与asp.net的对话
    作死作死,完美主义,又“重写”了
    学习的最大动力是想要更加减少重复性工作
    三种可执行脚本的入门总结1
    [Python学习]遇到阻碍:可以在win平台下使用的unix shell环境
    .bat批处理脚本让cmd命令行提示符cd到工作目录
  • 原文地址:https://www.cnblogs.com/yidashi110/p/10252006.html
Copyright © 2011-2022 走看看