window環境安裝mysql5.7.21,具體內容如下
1. 從MySQL官網下載免安裝的壓縮包mysql-5.7.21-winx64.zip
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)
Copyright (c) 2000, 2018, 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>
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;
精彩專題分享:mysql不同版本安裝教程 mysql5.7各版本安裝教程
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- Windows系統下mysql5.7.21安裝詳細教程
- mysql 5.7.21 winx64安裝配置方法圖文教程
- MySQL5.7.21安裝與密碼圖文配置教程
- mysql 5.7.21 解壓版安裝配置方法圖文教程
- mysql installer web community 5.7.21.0.msi安裝圖文教程
- mysql 5.7.21 winx64免安裝版配置方法圖文教程
- mysql5.7.21安裝配置教程
- mysql 5.7.21解壓版安裝配置方法圖文教程(win10)
- mysql 5.7.20\5.7.21 免安裝版安裝配置教程
- mysql 5.7.21 解壓版安裝配置圖文教程