• 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
    
  • 相关阅读:
    jmeter压测:failed (99: Cannot assign requested address) while connecting to upstream,问题解决
    linux主机设置免密登录
    linux环境 jdk+mysql+redis安装初始化步骤
    互联网系统设计原则
    LINUX运维常用命令
    性能测试岗位常见面试题
    查看电脑已连接过的WIFI密码
    Jenkins安装后,安装插件失败。报错SunCertPathBuilderException
    【java】javac命令在win10不可用,提示javac不是内部或外部命令,也不是可运行的程序【解决方法】
    .NET跨平台实践:.NetCore、.Net5/6 Linux守护进程设计
  • 原文地址:https://www.cnblogs.com/evescn/p/12752331.html
Copyright © 2020-2023  润新知