通过压缩包安装MySQL教程

本文记录一下Windows下的MySQL的安装过程,需要教程的自取。

当前系统环境:Windows 10,MySQL最新版本:8.0.19

下载与解压
  1. 访问MySQL官方下载页面
  2. 此时页面会根据浏览器的UA自动定位操作系统。Windows环境下会自动定位到Microsoft Windows
  3. 选择下载压缩包的安装版本:Windows (x86, 64-bit), ZIP Archive
  4. … 等待下载 …
  5. 将下载好的压缩包解压到自己喜欢的位置,例如解压到D:\Program Files\mysql-8.0.19-winx64

安装

  1. 以管理员打开命令行
  2. 进入到解压目录中的bin文件夹,如D:\Program Files\mysql-8.0.19-winx64\bin
  3. 安装服务: mysqld.exe install
  4. 初始化系统数据库: mysqld.exe --initialize --console,此处控制台会输出初始密码。
  5. 启动 mysql 服务:net start mysql
C:\WINDOWS\system32>cd D:\Program Files\mysql-8.0.19-winx64\bin

C:\WINDOWS\system32>D:

D:\Program Files\mysql-8.0.19-winx64\bin>mysqld.exe install
Service successfully installed.

D:\Program Files\mysql-8.0.19-winx64\bin>mysqld.exe --initialize --console 
2020-04-23T03:57:32.838774Z 0 [System] [MY-013169] [Server] D:\Program Files\mysql-8.0.19-winx64\bin\mysq1d.exe (mysq1d 8.0.19) initializing of server in progress as process 2058
2020-04-23T03:57:33.062512Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: fapC%LfHqULO
2020-04-23T03:57:38.258426Z 0 [SystemJ [MY-013170] [Server] D:\Program Files\mysql-8.0.19-winx64\bin\mysq1d.exe (mysq1d 8.0.19) initializing of server has comp1eted

D:\Program Files\mysql-8.0.19-winx64\bin>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。

初次使用重置密码

  1. 使用root用户登录,输入上一步中控制台中输出的默认密码。
  2. 修改密码
D:\Program Files\mysql-8.0.19-winx64\bin>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 921
Server version: 8.0.19 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> alter user 'root'@'localhost' identified with mysql_native_password by 'mysql';
Query OK, 0 rows affected (0.15 sec)

mysql> exit
Bye

配置

修改解压目录下的 my.ini文件,不存在则新建该文件。

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir= D:\ProjectTools\mysql-8.0.11-winx64
# 设置mysql数据库的数据的存放目录
datadir= D:\ProjectTools\mysql-8.0.11-winx64\data
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值