MySQL Community Downloads MySQL社区版压缩包下载地址 https://dev.mysql.com/downloads/mysql/
解压到了C盘
没打算设置环境变量
右键点击开始 或 win+x
以管理员身份打开 PowerShell
进入到安装目录下的 bin 目录
可以输入cd
后, 拖动 bin 文件夹到控制台, 一般会自动变成路径
也可以用“资源管理器”进入bin 文件夹, 然后点左上的”文件“ , 鼠标移到”打开 Windows PowerShell“, 然后点击”以管理员身份打开 Windows PowerShell“
除了 PowerShell,也测试了 CMD , 发现一些不同
-
CMD的路径只能用
\
, 不能用/
, PowerShell两者都可以 -
在没配置环境变量路径的情况下, CMD可以直接运行本路径下的x.exe文件,PowerShell要加
./
./mysqld
或.\mysqld
-
当缺少
VCRUNTIME140_1.dll
时, CMD会弹窗, PowerShell不会弹窗,没有任何提示
此时系统缺少 VCRUNTIME140_1.dll , CMD执行··
解决 VCRUNTIME140_1.dll 的方法
下载安装 微软常用运行库合集
微软常用运行库合集-果核剥壳版
微软常用运行库合集-果核剥壳版 – MSVBCRT.AIO.2022.10.21.zip
mysqld --initialize-insecure [–console]
PowerShell 执行 --initialize-insecure
没有成功
PS C:\mysql-8.0.32-winx64\bin> ./mysqld --initialize-inserure
2023-03-01T11:16:41.360375Z 0 [System] [MY-010116] [Server] C:\mysql-8.0.32-winx64\bin\mysqld.exe (mysqld 8.0.32) starting as process 7140
2023-03-01T11:16:41.363942Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\mysql-8.0.32-winx64\data\mysqld_tmp_file_case_insensitive_test.lower-test
2023-03-01T11:16:41.364046Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\mysql-8.0.32-winx64\data\mysqld_tmp_file_case_insensitive_test.lower-test
2023-03-01T11:16:41.364236Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\mysql-8.0.32-winx64\data\' (OS errno: 2 - No such file or directory)
2023-03-01T11:16:41.366525Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-01T11:16:41.366787Z 0 [System] [MY-010910] [Server] C:\mysql-8.0.32-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
PS C:\mysql-8.0.32-winx64\bin> ./mysqld --initialize-inserure --console
2023-03-01T11:18:10.162144Z 0 [System] [MY-010116] [Server] C:\mysql-8.0.32-winx64\bin\mysqld.exe (mysqld 8.0.32) starting as process 7416
2023-03-01T11:18:10.165405Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\mysql-8.0.32-winx64\data\mysqld_tmp_file_case_insensitive_test.lower-test
2023-03-01T11:18:10.165477Z 0 [Warning] [MY-010091] [Server] Can't create test file C:\mysql-8.0.32-winx64\data\mysqld_tmp_file_case_insensitive_test.lower-test
2023-03-01T11:18:10.165704Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\mysql-8.0.32-winx64\data\' (OS errno: 2 - No such file or directory)
2023-03-01T11:18:10.168147Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-01T11:18:10.168418Z 0 [System] [MY-010910] [Server] C:\mysql-8.0.32-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
PS C:\mysql-8.0.32-winx64\bin>
CMD 执行 --initialize-insecure
成功了
C:\mysql-8.0.32-winx64\bin>mysqld --initialize-insecure --console
2023-03-01T11:18:56.019591Z 0 [System] [MY-013169] [Server] C:\mysql-8.0.32-winx64\bin\mysqld.exe (mysqld 8.0.32) initializing of server in progress as process 4180
2023-03-01T11:18:56.121130Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-01T11:18:57.549669Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-03-01T11:18:58.974943Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
在 PowerShell 启动mysql服务成功了
PS C:\mysql-8.0.32-winx64\bin> ./mysqld install
Service successfully installed.
PS C:\mysql-8.0.32-winx64\bin> Start-Service -Name mysql
警告: 正在等待服务“mysql (MySQL)”启动...
PS C:\mysql-8.0.32-winx64\bin>
PS C:\mysql-8.0.32-winx64\bin> ./mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
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>