MySQL8離線安裝


傻瓜式步驟Ctrl+C /Ctrl+V:

 

現在離線安裝包:

  1. 登錄官網准備下載

https://dev.mysql.com/downloads/mysql/

 

 

 

 

2,開始下載

 

 

 

 

解壓安裝包:

開始解壓:

 

 

 

 

 

解壓完成:

 

 

 

 

新建init文件:

在解壓目錄下創建my.ini文件

[Client]

port = 3306

 

[mysqld]

#設置3306端口

port = 3306

# 設置mysql的安裝目錄

basedir=D:\WorkSpace\DevEnv\Databases\MySQL\mysql8

# 設置mysql數據庫的數據的存放目錄

datadir=D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\data

# 允許最大連接數

max_connections=20

# 服務端使用的字符集默認為8比特編碼的latin1字符集

character-set-server=utf8

# 創建新表時將使用的默認存儲引擎

default-storage-engine=INNODB

 

[mysql]

# 設置mysql客戶端默認字符集

default-character-set=utf8

 

初始化MySQL:

使用管理員運行dos窗口:

 

 

 

 

使用命令進行初始化MySQL:

C:\Users\admin>d:

D:\>cd D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>mysqld --initialize --user=mysql --console

2020-06-01T12:56:18.263432Z 0 [System] [MY-013169] [Server] D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin\mysqld.exe (mysqld 8.0.20) initializing of server in progress as process 35440

2020-06-01T12:56:18.278456Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.

2020-06-01T12:56:18.293667Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2020-06-01T12:56:18.822197Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2020-06-01T12:56:20.349728Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *9OjstMrX.Qp

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>

初始化完成如下:

 

 

 

 

命令安裝MySQL:

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>mysqld --install mysql

Service successfully installed.

 

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>

 

 

 

 

啟動MySQL服務:

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>net start mysql

mysql 服務正在啟動 .

mysql 服務已經啟動成功。

 

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>

登錄MySQL:

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>mysql -u root -p

Enter password: ************

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.20

 

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>

修改MySQL8的密碼:

注意:到了MySQL8對於修改密碼擁有了嚴格的語法限制:

mysql> alter user'root'@'localhost' identified with mysql_native_password by 'root' ;

Query OK, 0 rows affected (0.02 sec)

 

mysql> Flush privileges;

Query OK, 0 rows affected (0.04 sec)

 

mysql> exit;

Bye

 

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>

 

使用新密碼登錄MySQL:

D:\WorkSpace\DevEnv\Databases\MySQL\mysql8\bin>mysql -u root -p

Enter password: ****

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 8.0.20 MySQL Community Server - GPL

 

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> exit;

Bye

 

配置環境變量

 

 

 

開始配置環境變量

為了后續方便,所以配置MySQL Path變量

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM