Windows10安装MySQL5.7.43

下载安装包
mysql-5.7.43-winx64.zip

解压到目录C:\Program Files\mysql-5.7.43-winx64,并在该目录中创建配置文件my.ini

bash 复制代码
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8

[mysqld]
# 设置3306端口
port = 3306 
# 设置mysql的安装目录
basedir=C:\Program Files\mysql-5.7.43-winx64
# 设置mysql数据库的数据的存放目录
datadir=C:\Program Files\mysql-5.7.43-winx64\data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

初始化数据库并生成临时密码

bash 复制代码
C:\Program Files\mysql-5.7.43-winx64\bin> .\mysqld.exe --initialize --console
2023-10-16T14:36:54.265391Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2023-10-16T14:36:54.598124Z 0 [Warning] InnoDB: New log files created, LSN=45790
2023-10-16T14:36:54.665754Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2023-10-16T14:36:54.743420Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 73d25052-6c31-11ee-b7a2-74d43510f3a8.
2023-10-16T14:36:54.753703Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2023-10-16T14:36:55.542757Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2023-10-16T14:36:55.547191Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2023-10-16T14:36:55.554480Z 0 [Warning] CA certificate ca.pem is self signed.
2023-10-16T14:36:55.804792Z 1 [Note] A temporary password is generated for root@localhost: eZ7iZBAsh_hk

安装MySQL服务

bash 复制代码
C:\Program Files\mysql-5.7.43-winx64\bin> .\mysqld.exe install
Service successfully installed.

启动MySQL服务

bash 复制代码
C:\Program Files\mysql-5.7.43-winx64\bin> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

修改MySQL密码

bash 复制代码
C:\Program Files\mysql-5.7.43-winx64\bin> .\mysql.exe -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.43

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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 'password';

设置开机启动

以管理员身份运行命令提示符

bash 复制代码
C:\Users\Administrator>sc config mysql start=auto
[SC] ChangeServiceConfig 成功
相关推荐
Think Spatial 空间思维29 分钟前
【HTTPS基础概念与原理】TLS握手过程详解
数据库·网络协议·https
逝水如流年轻往返染尘36 分钟前
MySQL表的增删查改
mysql
laowangpython1 小时前
MySQL基础面试通关秘籍(附高频考点解析)
数据库·mysql·其他·面试
mooyuan天天1 小时前
SQL注入报错“Illegal mix of collations for operation ‘UNION‘”解决办法
数据库·web安全·sql注入·dvwa靶场·sql报错
运维-大白同学1 小时前
go-数据库基本操作
开发语言·数据库·golang
R-sz1 小时前
通过从数据库加载MinIO配置并初始化MinioClient,spring boot之Minio上传
数据库·oracle
洛阳泰山2 小时前
Windows系统部署MongoDB数据库图文教程
数据库·windows·mongodb
医只鸡腿子2 小时前
3.2/Q2,Charls最新文章解读
数据库·数据挖掘·数据分析·深度优先·数据库开发
bang___bang_2 小时前
PostgreSQL内幕剖析——结构与架构
数据库·postgresql
龙俊亨3 小时前
达梦数据库查看各数据库表内容
数据库