這個教程教你的是若是經過壓縮包
安裝,而不是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
後面,顯示添加,不要少了引號
,這很重要.