• centos7.6 使用yum安装mysql5.7


    1、下载yum源的rmp包

    # wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

    2、安装yum源

    # yum -y localinstall mysql57-community-release-el7-11.noarch.rpm

    3、清理yum缓存

    # yum clean all

    4、安装

    # yum -y install mysql-community-server

    5、修改/etc/my.cnf文件

    1、添加sql模式
    sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
    
    2、注释bind
    # bind 127.0.0.1
    
    3、修改data目录
    datadir=/data1/mysql/data
    
    4、修改最大连接数
    max_connections=500
    
    5、设置默认的字符集
    character-set-server=utf8
    
    6、添加其他信息
    [client]
    default-character-set=utf8
    [mysql]
    default-character-set=utf8

    注:其他修改字符集的方式:

    修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置
    
    character_set_server=utf8
    
    init_connect='SET NAMES utf8'

    6、创建数据目录

    #  mkdir /data1/mysql/data -p

    7、启动以及设置开启启动

    # systemctl start mysqld
    # systemctl enable mysqld
    # systemctl daemon-reload

    8、修改密码

    1、找出默认的密码
    # awk '/password/{print $NF}' /var/log/mysqld.log

    2、修改密码
    # mysqladmin -uroot -p'旧密码' password '新密码'

    9、重启mysql

    # systemctl restart mysqld

    10、数据库授权

    # mysql -uroot -p
    
    mysql> grant all on *.* to root@'%' identified by '你的密码';
    mysql> flush privileges;

    11、查看权限

    show grants for root

     12、查看编码

    mysql> show variables like '%character%';

  • 相关阅读:
    js字符串空格和换行
    python resources
    -eous
    英语资源网站
    -iatry 没病走两步
    book corpus
    epub converters
    brainstorm detain
    craftsman
    parachute
  • 原文地址:https://www.cnblogs.com/yjt1993/p/12492416.html
Copyright © 2020-2023  润新知