win11安装MySQL8.0.32记录

win11安装MySQL8.0.32记录

一、下载MySQL

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

二、将压缩包解压至安装目录

请添加图片描述

三、配置环境变量

请添加图片描述

四、新建my.ini文件

请添加图片描述
请添加图片描述

[mysqld]
# 设置3306端口
port=3306
 
# 自定义设置mysql的安装目录,即解压mysql压缩包的目录
basedir=D:\Program Files\MySQL\mysql-8.0.32-winx64
 
# 自定义设置mysql数据库的数据存放目录
datadir=D:\Program Files\MySQL\mysql-8.0.32-winx64\data
 
# 允许最大连接数
max_connections=200
 
# 允许连接失败的次数,这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
 
# 服务端使用的字符集默认为UTFMB4
character-set-server=utf8
 
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
 
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
 
[client]
# 设置mysql客户端连接服务端时默认使用的端口和默认字符集
port=3306
default-character-set=utf8mb4
参数名称说明
port表示 MySQL 服务器的端口号。
basedir表示 MySQL 的安装路径。
datadir表示 MySQL 数据文件的存储位置,也是数据表的存放位置。
max_connections表示允许同时访问MySQL服务器的最大连接数,其中一个连接是保留的,留给管理员专用的。
max_connect_errors表示允许连接失败的次数,这是为了防止有人从该主机试图攻击数据库系统。
default-character-set表示服务器端默认的字符集。
default-storage-engine创建数据表时,默认使用的存储引擎。
default_authentication_plugin默认使用“mysql_native_password”插件认证,而非caching_sha2_password。

五、安装MySQL

5.1 以管理员身份打开命令提示符

请添加图片描述

5.2 安装MySQL

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

5.3 初始化

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysqld --initialize --console
2024-01-29T07:23:03.421213Z 0 [System] [MY-013169] [Server] D:\Program Files\MySQL\mysql-8.0.32-winx64\bin\mysqld.exe (mysqld 8.0.32) initializing of server in progress as process 10788
2024-01-29T07:23:03.422541Z 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.
2024-01-29T07:23:03.445955Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-01-29T07:23:03.877003Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-01-29T07:23:04.766645Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: O**********C

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysqld --install
The service already exists!
The current server installed: "D:\Program Files\MySQL\mysql-8.0.32-winx64\bin\mysqld" MySQL

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysqld --initialize-insecure

请添加图片描述

5.4 启动mysql

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

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysql -uroot -p
Enter password: ************
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

5.5 重置数据库密码

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysql -uroot -p
Enter password: ************(此处为初始化产生的密码)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.32

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>
mysql> alter user root@localhost identified by 'password' password expire never;
Query OK, 0 rows affected (0.02 sec)

mysql> alter user root@localhost identified with mysql_native_password by '********';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit;
Bye

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>mysql -uroot -p********
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.32 MySQL Community Server - GPL

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> exit;
Bye

5.6 查看本机IP地址

D:\Program Files\MySQL\mysql-8.0.32-winx64\bin>ipconfig/all
无线局域网适配器 本地连接* 10:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
   物理地址. . . . . . . . . . . . . : **-**-**-**-**-**
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : ****::****:****:****:****%12(首选)
   IPv4 地址 . . . . . . . . . . . . : ***.***.***.**(首选)
   子网掩码  . . . . . . . . . . . . : ***.***.***.*
   默认网关. . . . . . . . . . . . . :
   TCPIP 上的 NetBIOS  . . . . . . . : 已启用

5.7 navicat连接数据库

请添加图片描述

六、参考文献

  1. Win11,MySQL8 安装教程。

  2. win11下MySQL8详细安装教程

  3. Win11安装mysql8.0.x教程

  4. MySQL Product Archives

  5. win10查看本机IP

  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值