zoukankan      html  css  js  c++  java
  • CentOS7安装MySQL服务

    CentOS7安装MySQL服务

    1、安装wget

    yum install wget
    

    2、mysql下载

    wget  http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
    

    3、安装软件源

    rpm -Uvh mysql57-community-release-el7-10.noarch.rpm
    

    4、 安装mysql服务端

    yum install  -y  mysql-community-server
    

    5、启动mysql

    service mysqld start
    
    • 如果在启动服务时失败,报如下错误
    Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.
    

    参见另一篇文章 虚拟机启动mysql服务遇到的问题

    6、检查mysql运行状态

    service mysqld status
    
    [root@test-zj ~]# systemctl status mysqld
    ● mysqld.service - MySQL Server
       Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
       Active: active (running) since Wed 2020-04-22 07:15:23 UTC; 37s ago
         Docs: man:mysqld(8)
               http://dev.mysql.com/doc/refman/en/using-systemd.html
     Main PID: 2141 (mysqld)
       CGroup: /system.slice/mysqld.service
               └─2141 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
    
    Apr 22 07:15:08 test-zj systemd[1]: Starting MySQL Server...
    Apr 22 07:15:23 test-zj systemd[1]: Started MySQL Server.
    
    

    7、查看临时密码

    grep 'temporary password' /var/log/mysqld.log
    
    [root@test-zj ~]# grep 'temporary password' /var/log/mysqld.log
    2020-04-22T07:15:19.556900Z 1 [Note] A temporary password is generated for root@localhost: u1J1-TkhsUX<
    

    8、输入临时密码,进行登录

    mysql -u root -p
    
    [root@test-zj ~]# mysql -u root -p 
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.7.29
    
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql>
    

    9、修改validate_password_policy参数的值

    set global validate_password_policy=0;
    

    10、修改密码的长度

    set global validate_password_length=1;
    

    11、修改密码

    ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
    
    如果不执行9和10,直接修改密码,会报如下错误 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
    

    转载文档

    https://juejin.im/post/5def2a82518825126e6396be
    
  • 相关阅读:
    hdu5728 PowMod
    CF1156E Special Segments of Permutation
    CF1182E Product Oriented Recurrence
    CF1082E Increasing Frequency
    CF623B Array GCD
    CF1168B Good Triple
    CF1175E Minimal Segment Cover
    php 正则
    windows 下安装composer
    windows apache "The requested operation has failed" 启动失败
  • 原文地址:https://www.cnblogs.com/evescn/p/12752331.html
Copyright © 2011-2022 走看看