MySQL8离线安装

现在离线安装包:

  1. 登录官网准备下载

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

 MySQL8离线安装

 

 

 

2,开始下载

 MySQL8离线安装

 

 

 

解压安装包:

开始解压:MySQL8离线安装

 MySQL8离线安装

 

 

 

 

解压完成:

 MySQL8离线安装

 

 

 

新建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窗口:

 MySQL8离线安装

 

 

 

使用命令进行初始化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>

初始化完成如下:

 MySQL8离线安装

 

 

 

命令安装MySQL:

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

Service successfully installed.

 

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

 MySQL8离线安装

 

 

 

启动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变量

 MySQL8离线安装

 

MySQL8离线安装

上一篇:PLSQL_Oracle分区表和相应的分区索引管理和使用(案例)(创建交易表等大表时进行分区提高效率)


下一篇:sqlserver事务加锁机制