MySQL8離線安裝

如今離線安裝包:

  1. 登陸官網準備下載

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

 

 

 

 

2,開始下載sql

 

 

 

 

解壓安裝包:

開始解壓:數據庫

 

 

 

 

 

解壓完成:ide

 

 

 

 

新建init文件:

在解壓目錄下建立my.ini文件編碼

[Client]spa

port = 33063d

 

[mysqld]server

#設置3306端口blog

port = 3306ci

# 設置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變量

 

相關文章
相關標籤/搜索