1、mysqld -initialize-insecure

问题:未出现随机密码

原因:原先运行过该语句

解决方案:删除之前运行生成的data文件夹

D:\Program Files\MySql\bin>mysqld -initialize-insecure
2022-02-08T06:01:51.967968Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2022-02-08T06:01:51.967983Z 0 [System] [MY-010116] [Server] D:\Program Files\MySql\bin\mysqld.exe (mysqld 8.0.28) starting as process 8364
2022-02-08T06:01:51.969424Z 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.
2022-02-08T06:01:51.970109Z 0 [Warning] [MY-010091] [Server] Can't create test file D:\Program Files\MySql\data\mysqld_tmp_file_case_insensitive_test.lower-test
2022-02-08T06:01:51.970164Z 0 [Warning] [MY-010091] [Server] Can't create test file D:\Program Files\MySql\data\mysqld_tmp_file_case_insensitive_test.lower-test
2022-02-08T06:01:51.970310Z 0 [ERROR] [MY-013276] [Server] Failed to set datadir to 'D:\Program Files\MySql\data\' (OS errno: 2 - No such file or directory)
2022-02-08T06:01:51.975219Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-02-08T06:01:51.975511Z 0 [System] [MY-010910] [Server] D:\Program Files\MySql\bin\mysqld.exe: Shutdown complete (mysqld 8.0.28)  MySQL Community Server - GPL.

2、net start mysql

问题:mysql无法启动

解决方案:卸载mysql,再重新安装mysql

D:\Program Files\MySql\bin>mysqld -remove
Service successfully removed.

D:\Program Files\MySql\bin>net start mysql
服务名无效。


D:\Program Files\MySql\bin>mysqld --install mysql
Service successfully installed.

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

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐