windwos10 安裝Mysql8.0 2021最新傻瓜式教程

這個教程教你的是若是經過壓縮包安裝,而不是installermysql

下載Mysql

下載地址 https://dev.mysql.com/downloa...sql

下載Windows (x86, 64-bit), ZIP Archive,即體積比較小的那個shell

image.png

解壓縮

解壓縮以後放到C盤
C:\Program Files\Mysqlbash

image.png

Program Files文件夾建立一個 Mysql文件夾,把解壓後的文件夾放到 Mysql文件夾

添加環境變量

C:\Program Files\Mysql\mysql-8.0.21-winx64\bin添加到環境變量中spa

注意把 mysql-8.0.21-winx64換成你本身的版本

添加服務

mysqld install

添加過環境變量就須要中相對路徑或者絕對路徑去調用mysqldcode

注意是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後面,顯示添加,不要少了引號,這很重要.

常見報錯

  • ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    解決辦法:輸入密碼最好直接在-p後面,顯示添加,不要少了引號,這很重要.
相關文章
相關標籤/搜索