Win10搭建MySQL 8離線安裝版

Users who are installing from the noinstall package can use the instructions in this section to manually install MySQL. The process for installing MySQL from a ZIP Archive package is as follows:

  1. Extract the main archive to the desired install directory

    Optional: also extract the debug-test archive if you plan to execute the MySQL benchmark and test suite

  2. Create an option file

  3. Choose a MySQL server type

  4. Initialize MySQL

  5. Start the MySQL server

  6. Secure the default user accounts

This process is described in the sections that follow.

這段英文描述是mysql官網關於離線版安裝說明,詳情請查看 官網文檔

 

Step1: 下載軟件

1.  登錄mysql官網

如下圖所示   PS:第一次GIF工具,試了很多次,用的不是很好,請見諒

2. 解壓壓縮包

試圖

Step2 :安裝MYSQL

 

1. 創建MySQL配置文件

         在解壓的文件價下創建my.ini文件;編輯my.ini配置以下基本信息:

[client]
# Set the mysql client default character set
default-character-set=utf8
# 設置mysql客戶端連接服務端時默認使用的端口
port=3306
 
[mysqld]
# set 3306 port
port=3306
# set basedir to your installation path
basedir=E:\\mysql-8.0.18-winx64
# set datadir to the location of your data directory
datadir=E:\\mysql-8.0.18-winx64\\data
# 允許最大連接數
max_connections=200
# 允許連接失敗的次數。這是爲了防止有人從該主機試圖攻擊數據庫系統
max_connect_errors=10
# 服務端使用的字符集默認爲UTF8
character-set-server=utf8

2. 啓動並初始化MySQL數據庫

以管理員身份打開cmd命令行工具;

然後切換目錄至解壓目錄的bin文件夾:

C:\Users\Administrator>e:

E:\mysql-8.0.18-winx64\bin>mysqld --initialize --console

回車之後會出現

2019-11-16T12:41:33.034812Z 0 [System] [MY-013169] [Server] E:\mysql-8.0.18-winx64\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 1932
2019-11-16T12:41:35.864612Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: w<hJyyMil2Rg

加粗的部分爲mysql初始化的密碼

3. 初始化完成後安裝MySQL

輸入安裝命令

D:\Program Files\mysql-8.0.17-winx64\bin>mysqld install
Service successfully installed.

啓動MySQL

D:\Program Files\mysql-8.0.17-winx64\bin>net start mysql
MySQL 服務正在啓動 .
MySQL 服務已經啓動成功。

登陸MySQL

mysql -h 主機名 -u 用戶名 -p

祕密爲初始化密碼

修改默認密碼

以下操作都是在cmd命令提示符用默認密碼登陸成功後,在mysql> 提示符下完成。

ALTER user 'root'@'localhost' IDENTIFIED BY '123456';

123456是修改後的密碼,自定義即可;

修改後刷新權限

flush privileges;

加入環境變量

右鍵點擊此電腦,點擊屬性,點擊左側高級系統設置,點擊環境變量

系統變量(S)中找到Path變量,雙擊進入,點擊新建

輸入D:\Program Files\mysql-8.0.17-winx64\bin

完成。就可以直接在cmd使用mysql命令了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章