MySQL(压缩包)配置过程
1.下载MySQL安装包
MySQL :: Download MySQL Community Server
2.将下载完成的压缩包解压到某一目录,如:
1 | C:\MySQL |
并在系统环境中添加目录C:\MySQL\bin。
3.在上述目录下新建my.ini文件,并在文件中输入以下内容(注意basedir和datadir需修改为你的目录):
[mysqld] port=3306 basedir=C:\MySQL datadir=C:\MySQL\data max_connections=200 max_connect_errors=10 character-set-server=utf8mb4 default-storage-engine=INNODB default-storage-engine=INNODB [mysql] default-character-set=utf8mb4 [client] port=3306 default-character-set=utf8mb4
4.以管理员身份运行cmd,使用指令
1 | mysqld --initialize --console |
初始化MySQL服务,并记下此处生成的root用户的初始密码:
1 2 3 4 5 | C:\Windows\System32>mysqld --initialize --console 2024-10-13T12:10:48.416788Z 0 [System] [MY-013169] [Server] C:\MySQL\bin\mysqld.exe (mysqld 8.0.39) initializing of server in progress as process 15240 2024-10-13T12:10:48.446955Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-10-13T12:10:48.801853Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2024-10-13T12:10:51.121715Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: wy+LuYklk3y4 |
5.继续在cmd按照以下过程使用指令安装并启动MySQL服务:
1 2 3 4 5 6 | C:\Windows\System32>mysqld install Service successfully installed. C:\Windows\System32>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。 |
6.使用先前生成的密码登录root用户并使用指令
1 | ALTER USER 'root' @ 'localhost' IDENTIFIED BY '123456' ; |
修改root用户的密码,完整过程如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | C:\Windows\System32>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.39 Copyright (c) 2000, 2024, 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 BY '123456' ; Query OK, 0 rows affected (0.01 sec) |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南