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)
  • 结果
    在这里插入图片描述

posted on   运维开发玄德公  阅读(11)  评论(0编辑  收藏  举报  

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示