window環境安裝mysql5 7 21

2021-08-14 18:27:46 字數 2494 閱讀 4556

2. 解壓到相應的目錄(此處解壓到f:\mysql-5.7.21-winx64)

3. 配置環境變數,將mysql的啟動目錄(f:\mysql-5.7.21-winx64\bin)新增到path中

4. 在mysql目錄下(f:\mysql-5.7.21-winx64)建立my.ini檔案,內容如下:

[mysql]  

# 設定mysql客戶端預設字符集

default-character-set=utf8

[mysqld]

#設定3306埠

port = 3306

# 設定mysql的安裝目錄

basedir=f:\mysql-5.7.21-winx64

# 設定mysql資料庫的資料的存放目錄

datadir=f:\mysql-5.7.21-winx64\data

# 允許最大連線數

max_connections=200

# 服務端使用的字符集預設為8位元編碼的latin1字符集

character-set-server=utf8

# 建立新錶時將使用的預設儲存引擎

default-storage-engine=innodb

5. 管理員身份執行cmd

切換目錄:

c:\windows\system32>cd f:\mysql-5.7.21-winx64\bin

生成mysql服務:

f:\mysql-5.7.21-winx64\bin>mysqld -install

service successfully installed.

生成data目錄:

f:\mysql-5.7.21-winx64\bin>mysqld --initialize-insecure --user=mysql

啟動mysql服務:

c:\windows\system32>net start mysql

mysql 服務正在啟動 .

mysql 服務已經啟動成功。

6. 登入資料庫,修改密碼(預設密碼為空)

登入資料庫:

c:\windows\system32>mysql -uroot -p

enter password:

welcome to the mysql monitor. commands end with ; or \g.

your mysql connection id is 2

server version: 5.7.21 mysql community server (gpl)

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>

mysql>

mysql> show databases;

+--------------------+

| database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

+--------------------+

4 rows in set (0.00 sec)

mysql> use mysql;

database changed

mysql> update user set authentication_string=password("新密碼") where user="root";

query ok, 1 row affected, 1 warning (0.00 sec)

rows matched: 1 changed: 1 warnings: 1

mysql>

mysql>flush privileges;

Window 下 MySQL 環境的安裝

mysql 是最流行的關係型資料庫管理系統,在web應用方面 mysql 是最好的rdbms relational database management system 關聯式資料庫管理系統 應用軟體之一。我選擇它的幾點原因 體積小,速度快 免費,源 開源,跨平台 使用者量大,遇到問題容易找到解決方...

window 安裝 vue環境

1.安裝node.js 2.基於node.js,利用 npm映象安裝相關依賴 在cmd裡直接輸入 npm install g cnpm registry 回車,等待安裝.3.安裝全域性vue cli腳手架,用於幫助搭建所需的模板框架 在cmd裡 1 輸入 cnpm install g vue cli...

window10環境安裝mysql

2.解壓壓縮包後,在該檔案目錄下建立乙個my.ini my.ini的具體內容如下 mysqld 設定3306埠 port 3306 設定mysql的安裝目錄 basedir h tools mysql 8.0.17 winx64 設定mysql資料庫的資料的存放目錄 datadir h tools ...