• mysql有关配置


    mysql有关配置

    mysql安装

    1. mysql安装方式有三种
    • 源代码:编译安装
    • 二进制格式的程序包:展开至特定路径,并经过简单配置后即可使用
    • 程序包管理器管理的程序包:
      • rpm:有两种
        • OS Vendor:操作系统发行商提供的
        • 项目官方提供的
      • deb

    MySQL配置

    #启动mysql并设置开机自动启动
    systemctl enable --now mariadb
    systemctl status mariadb
    
    #确保3306端口已经监听起来
    ss -antl
    
    #在日志文件中找出临时密码
    grep "password" /var/log/mysqld.log
    
    #使用获取到的临时密码登录mysql
    [root@localhost ~]# mysql -uroot -p
    Enter password:     //此处输入密码,可以直接复制你的密码粘贴至此处,也可手动输入
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.7.23
    
    Copyright (c) 2000, 2018, 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>          //看到有这样的标识符则表示成功登录了
    

    修改密码

    [root@localhost ~]# mysql                   #默认是没有密码的,直接回车即可登入
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 2
    Server version: 5.5.68-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    MariaDB [(none)]> set password = password('123456');        #设置密码
    Query OK, 0 rows affected (0.00 sec)
    
    
    
    //修改mysql登录密码
    mysql> set global validate_password_policy=0;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> set global validate_password_length=1;
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'wangqing123!';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> quit
    Bye
    
  • 相关阅读:
    vscode_sync
    外国it视频教学文件
    关于登录状态,后台应该另外做一个接口来决定是否登录
    判断浏览器信息
    file控件预览
    githutb账号密码
    .net core 实践笔记(三)--封装底层
    .net core 实践笔记(二)--EF连接Azure Sql
    .net core 实践笔记(一)--开篇
    SQL引用DAL
  • 原文地址:https://www.cnblogs.com/itwangqiang/p/14235815.html
Copyright © 2020-2023  润新知