zoukankan      html  css  js  c++  java
  • CentOS7下安装MySQL5.7安装与配置(YUM)

    # 下载mysql源安装包

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

    # 安装mysql源

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

    检查mysql源是否安装成功

    yum repolist enabled | grep "mysql.*-community.*"

    看到上图所示表示安装成功。 

    安装MySQL

    yum install mysql-community-server

    启动MySQL服务

    systemctl start mysqld

    查看MySQL的启动状态

    shell> systemctl status mysqld
    ● mysqld.service - MySQL Server
    Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
    Active: active (running) since 五 2016-06-24 04:37:37 CST; 35min ago
    Main PID: 2888 (mysqld)
    CGroup: /system.slice/mysqld.service
    └─2888 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

    6月 24 04:37:36 localhost.localdomain systemd[1]: Starting MySQL Server...
    6月 24 04:37:37 localhost.localdomain systemd[1]: Started MySQL Server.

    开机启动

    systemctl enable mysqld

    systemctl daemon-reload

    修改root本地登录密码

    mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:

    shell> grep 'temporary password' /var/log/mysqld.log

    shell> mysql -uroot -p

    shell> mysql -uroot -p mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

    注意:mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

    添加远程登录用户

    默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户,为了安全起见,我添加一个新的帐户:

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'yangxin'@'%' IDENTIFIED BY 'Yangxin0917!' WITH GRANT OPTION;

    配置默认编码为utf8

    修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:

    [mysqld]

    character_set_server=utf8

    init_connect='SET NAMES utf8'

    摘抄处:https://blog.csdn.net/xyang81/article/details/51759200

  • 相关阅读:
    [转]asp.net页面缓存技术
    UL和LI在div中的高度的IE6下兼容性
    jquery制作的横向图片滚动带横向滚动条TackerScroll
    电脑可以上网,但是qq登陆不上去?
    Introduction to discrete event system学习笔记4.6
    Introduction to Discrete event system学习笔记4.9
    Introduction to discrete event systemsstudy 4.5
    Symbolic synthesis of obserability requirements for diagnosability B.Bittner,M.Bozzano,A.Cimatti,and X.Olive笔记4.16
    Introduction to discrete event system学习笔记4.8pm
    Introduction to discrete event system学习笔记 4.8
  • 原文地址:https://www.cnblogs.com/QimiSun/p/10342124.html
Copyright © 2011-2022 走看看