zoukankan      html  css  js  c++  java
  • centos7 yum安装mysql5.7

    1 下载yum 源

    sudo wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
    

    2 安装yum源

    
    yum localinstall mysql57-community-release-el7-8.noarch.rpm
    

    3 安装MySQL

    
    yum install mysql-community-server
    

    4 启动mysql

     systemctl start mysqld
    

    5 查看登录密码

    mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过以下命令找到密码:

    grep 'temporary password' /var/log/mysqld.log
    
    2020-06-09T10:25:00.044193Z 1 [Note] A temporary password is generated for root@localhost: #%E1%awm#iAT
    

    6 登录mysql并修改密码

    利用上面得到的密码,去登录,第一次登录必须更改密码,并且密码的复杂度必须满足
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
    

    7 修改密码策略

    -- 选择0(LOW),1(MEDIUM),2(STRONG)其中一种,选择2需要提供密码字典文件
        validate_password_policy=0
     
    -- 如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
        validate_password = off
    

    编辑my.cnf配置文件

    [mysqld]
    
    validate_password_policy=0
    validate_password = off
    
    

    最后重启mysql即可

    8 设置远程登录

    grant all on *.* to 'root'@'%' identified by '123pwd';
    
    

    9 设置编码为utf-8

    编辑my.cnf
    
    [mysqld]
    character_set_server=utf8
    init_connect='SET NAMES utf8'
    
    

    最后重启mysql即可。

  • 相关阅读:
    204. Count Primes (Integer)
    203. Remove Linked List Elements (List)
    202. Happy Number (INT)
    201. Bitwise AND of Numbers Range (Bit)
    200. Number of Islands (Graph)
    199. Binary Tree Right Side View (Tree, Stack)
    198. House Robber(Array; DP)
    191. Number of 1 Bits (Int; Bit)
    190. Reverse Bits (Int; Bit)
    189. Rotate Array(Array)
  • 原文地址:https://www.cnblogs.com/huningfei/p/13079817.html
Copyright © 2011-2022 走看看