报错输出
C:\Users\demo>mysqld --defaults-file C:\Users\demo\Documents\my.ini --console
2022-11-15T12:23:44.882499Z 0 [System] [MY-010116] [Server] D:\mysql\bin\mysqld.exe (mysqld 8.0.31) starting as process 23772
2022-11-15T12:23:44.884515Z 0 [Warning] [MY-010091] [Server] Can't create test file D:\mysql\data\mysqld_tmp_file_case_insensitive_test.lower-test
2022-11-15T12:23:44.884604Z 0 [Warning] [MY-010091] [Server] Can't create test file D:\mysql\data\mysqld_tmp_file_case_insensitive_test.lower-test
2022-11-15T12:23:44.884764Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'D:\mysql\data\' (OS errno: 2 - No such file or directory)
2022-11-15T12:23:44.885182Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-11-15T12:23:44.885301Z 0 [System] [MY-010910] [Server] D:\mysql\bin\mysqld.exe: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
原启动命令
mysqld --defaults-file C:\Users\demo\Documents\my.ini --console
原因是启动参数格式写错...,忘记写等号了,无语
修改后的启动命令
mysqld --defaults-file=C:\Users\demo\Documents\my.ini --console
修改后重新启动成功
输出如下
C:\Users\demo>mysqld --defaults-file=C:\Users\demo\Documents\my.ini --console
2022-11-15T12:27:52.510161Z 0 [System] [MY-010116] [Server] D:\mysql\bin\mysqld.exe (mysqld 8.0.31) starting as process 29312
2022-11-15T12:27:52.523215Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-11-15T12:27:53.407003Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-11-15T12:27:53.541874Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2022-11-15T12:27:53.545449Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2022-11-15T12:27:53.566723Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-11-15T12:27:53.566892Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-11-15T12:27:53.591890Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2022-11-15T12:27:53.591994Z 0 [System] [MY-010931] [Server] D:\mysql\bin\mysqld.exe: ready for connections. Version: '8.0.31' socket: '' port: 3306 MySQL Community Server - GPL.