windows安装mysql

1. 下载

  • url
    https://dev.mysql.com/downloads/mysql/

  • 下载
    在这里插入图片描述

在这里插入图片描述

2. 安装|启动

解压缩

将下载后的文件解压缩到 E:\opt\ 下,生成 mysql-8.0.29-winx64 目录

初始化数据库

  • 打开cmd,进入mysql目录下的bin目录:
C:\Users\Administrator>e:
E:\opt>cd mysql-8.0.29-winx64\bin
  • 初始化数据库
E:\opt\mysql-8.0.29-winx64\bin>mysqld --initialize --console
2022-06-06T15:04:41.229440Z 0 [System] [MY-013169] [Server] E:\opt\mysql-8.0.29-winx64\bin\mysqld.exe (mysqld 8.0.29) initializing of server in progress as process 12228
2022-06-06T15:04:41.373478Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-06-06T15:04:47.991509Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-06-06T15:04:59.857361Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: I&C:,e7Qb>1a

如上图可见,自动生成的mysql密码为 I&C:,e7Qb>1a

安装mysql服务

E:\opt\mysql-8.0.29-winx64\bin>mysqld -install
Service successfully installed.

启动mysql

E:\opt\mysql-8.0.29-winx64\bin>sc start mysql

SERVICE_NAME: mysql
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x3
        WAIT_HINT          : 0x3a98
        PID                : 17136
        FLAGS              :

3. 修改密码/密码规则

如果不修改密码规则,navicat报错:Authentication plugin ‘caching_sha2_password’ cannot be loaded
在这里插入图片描述

  • 登录数据库
E:\opt\mysql-8.0.29-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.29

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.09 sec)
  • 修改加密规则和密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxxxx';
Query OK, 0 rows affected (0.09 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.05 sec)
  • 结果
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

玄德公笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值