安装mysql时Initialize Database出现错误

安装mysql时Initialize Database出现错误

https://img1.sycdn.imooc.com//climg/6241b293091803e209620728.jpg

Log日志如下:

Saving my.ini configuration file...
Saved my.ini configuration file.
Ended configuration step: Writing configuration file

Beginning configuration step: Updating Windows Firewall rules

Adding a Windows Firewall rule for MySQL80 on port 3306.
Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 3306" protocol=TCP localport=3306 dir=in action=allow
确定。


Successfully added the Windows Firewall rule.
Adding a Windows Firewall rule for MySQL80 on port 33060.
Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 33060" protocol=TCP localport=33060 dir=in action=allow
确定。


Successfully added the Windows Firewall rule.
Ended configuration step: Updating Windows Firewall rules

Beginning configuration step: Adjusting Windows service

Attempting to grant Network Service require filesystem permissions.
Granted permissions.
Adding new service
New service added
Ended configuration step: Adjusting Windows service

Beginning configuration step: Initializing database (may take a long time)

Attempting to run MySQL Server with --initialize-insecure option...
Starting process for MySQL Server 8.0.28...
Starting process with command: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1...
mysqld: File '.\姊呭ぇ澶х殑濂藉姪鎵?bin.index' not found (OS errno 2 - No such file or directory)
'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.28) initializing of server in progress as process 11964
The designated data directory C:\ProgramData\MySQL\MySQL Server 8.0\Data\ is unusable. You can remove all files that the server added to it.
Aborting
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.28)  MySQL Community Server - GPL.
Process for mysqld, with ID 11964, was run successfully and exited with code 1.
Failed to start process for MySQL Server 8.0.28.
Database initialization failed.
Ended configuration step: Initializing database (may take a long time)

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕燕燕 2022-03-29 10:27:17

同学,你好!安装过程中是否使用了中文路径,同学修改一下,不要使用中文路径

https://img1.sycdn.imooc.com//climg/62426e370900b15208130317.jpg

祝:学习愉快!

  • 提问者 坚持一下会死呀 #1

    我安装包的位置和安装的位置都没有中文,下面是我的安装位置,我之前成功安装过mysql8.0,之后删掉了,注册表和c盘内的文件都删掉了,这次是重新安装的。不知道是不是没有删干净的原因

    C:\Program Files (x86)\MySQL\MySQL Installer for Windows

    2022-03-29 10:33:12
  • 提问者 坚持一下会死呀 #2

    我也尝试了解压缩包安装mysql可是还是不行,好像是报了相同的错误,都会报如下错误

    The designated data directory C:\ProgramData\MySQL\MySQL Server 8.0\Data\ is unusable.

    2022-03-29 10:34:56
  • 同学,你好!在C:\ProgramData\MySQL\MySQL Server 8.0路径下找到my.ini配置文件,打开可以看到MySQL的安装路径和data路径,错误信息"The designated data directory C:\ProgramData\MySQL\MySQL Server 8.0\Data\ is unusable."说明配置时系统没有按照my.ini中配置的data路径创建数据文件,而是使用的mysql安装路径

    https://img1.sycdn.imooc.com//climg/624279a7095926ac10060462.jpg

    解决方案:查看mysql安装路径下是否有Data文件夹,如果没有手动创建一个,创建之后,右击文件夹属性->安全->编辑,添加写入权限

    https://img1.sycdn.imooc.com//climg/62427b0c0965f2b603770454.jpg

    然后再执行初始化命令,mysqld --initialize --console

    祝:学习愉快!

    2022-03-29 11:25:50
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星

相似问题

登录后可查看更多问答,登录/注册

请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师