windows环境下安装MySQL8

本文详细介绍了MySQL8.0版本的下载、解压、配置、初始化、服务安装及启动过程,包括my.ini配置文件的设置,初始化数据库并生成临时密码,以及如何修改密码和密码验证插件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.下载

MYSQL服务下载地址:https://dev.mysql.com/downloads/mysql/

2.解压

3.修改配置

在解压出的文件主目录中创建一个文本文件:my.ini

内容:

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M

 

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

 

# These are commonly set, remove the # and set as required.

basedir = D:\\bigdata\mysql-8.0.13-winx64 #MySQL主目录位置

datadir = D:\\bigdata\mysql-8.0.13-winx64\data # MySQL数据存放位置

port = 3306

# server_id = .....

 

 

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

 

character-set-server = utf8mb4

 

performance_schema_max_table_instances = 600

table_definition_cache = 400

table_open_cache = 256

 

[mysql]

default-character-set = utf8mb4

 

[client]

default-character-set = utf8mb4

4.初始化数据库

管理员身份运行cmd

D:\bigdata\mysql-8.0.13-winx64\bin\mysqld --initialize --console

输出:

2018-11-28T02:21:15.093589Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.

2018-11-28T02:21:15.093654Z 0 [System] [MY-013169] [Server] D:\bigdata\mysql-8.0.13-winx64\bin\mysqld.exe (mysqld 8.0.13) initializing of server in progress as process 22548

2018-11-28T02:21:44.207571Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: jrotKgpv8n-t

2018-11-28T02:22:00.823441Z 0 [System] [MY-013170] [Server] D:\bigdata\mysql-8.0.13-winx64\bin\mysqld.exe (mysqld 8.0.13) initializing of server has completed

上面方框中加粗的字符串为密码

5.安装MySQL服务

D:\bigdata\mysql-8.0.13-winx64\bin\mysqld --install mysql8

输出:

Service successfully installed.

6.启动MySQL服务

D:\bigdata\mysql-8.0.13-winx64\bin\net start mysql8

输出:

mysql8 服务正在启动 ...

mysql8 服务已经启动成功。

7.登陆MySQL

Mysql -uroot -p

jrotKgpv8n-t

8.修改密码和密码验证插件

ALTER USER 'root’@'localhost' IDENTIFIED WITH mysql_native_password BY '!QAZ2wsx12';

9.即可通过客户端连接工具

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值