zoukankan      html  css  js  c++  java
  • 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%';

  • 相关阅读:
    WindowsServer2003SP2EnterpriseEdition激活码
    2016/12/14渗透学习总结
    技术之路注定孤独
    几道office题的总结
    一路走来,只是清风
    【IIS】IIS中同时满足集成模式和经典模式
    IntelliJ IDEA如何build path
    kafka的集群安装
    尚硅谷 kafka
    队列
  • 原文地址:https://www.cnblogs.com/yjt1993/p/12492416.html
Copyright © 2011-2022 走看看