这个教程教你的是若是经过压缩包
安装,而不是installer
mysql
下载地址 https://dev.mysql.com/downloa...sql
下载Windows (x86, 64-bit), ZIP Archive
,即体积比较小的那个shell
解压缩以后放到C盘C:\Program Files\Mysql
bash
在Program Files
文件夹建立一个Mysql
文件夹,把解压后的文件夹放到Mysql
文件夹
把C:\Program Files\Mysql\mysql-8.0.21-winx64\bin
添加到环境变量中spa
注意把
mysql-8.0.21-winx64
换成你本身的版本
mysqld install
添加过环境变量就须要中相对路径或者绝对路径去调用mysqld
了code
注意是mysqld,不是mysql,由于mysql
是客户端程序,mysqld
是服务端程序
有些教程会教你配置my.ini
,这个文件不是必须的,因此这里不讲server
> cd "C:\Program Files\Mysql\mysql-8.0.21-winx64" > mysqld.exe --initialize --console 2021-05-15T03:14:48.650104Z 0 [System] [MY-013169] [Server] C:\Program Files\Mysql\mysql-8.0.21-winx64\bin\mysqld.exe (mysqld 8.0.21) initializing of server in progress as process 6040 2021-05-15T03:14:48.689134Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-05-15T03:14:49.796361Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-05-15T03:14:51.118883Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: _<AsDttMd1o2 > net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。 > mysql -u root -p"_<AsDttMd1o2" mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.21 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>
注意把
mysql-8.0.21-winx64
换成你本身的版本
上诉操做中有容易踩坑的地方教程
mysqld.exe --initialize --console
中的--console
不可少,否则会很麻烦-p
后面,显示添加,不要少了引号
,这很重要.-p
后面,显示添加,不要少了引号
,这很重要.