安装MySQL-9.1.0-winx64.msi的报错解决办法:Database initialization failed

报错Log:Database initialization failed.

Beginning configuration step: Writing configuration file

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 MySQL91 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 MySQL91 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 the required filesystem permissions to the 'NT AUTHORITY\NetworkService' account.
Granted permissions to the data directory.
Granted permissions to the install directory.
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 9.1.0...
Starting process with command: C:\Program Files\MySQL\MySQL Server 9.1\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 9.1\my.ini" --console --initialize-insecure=on --lower-case-table-names=1...
Process for mysqld, with ID 7608, was run successfully and exited with code -1073741819.
Failed to start process for MySQL Server 9.1.0.
Database initialization failed.
Ended configuration step: Initializing database (may take a long time)

尝试问题复现

image

寻找方法

  • 其他网上的各种尝试啦,比如:
    • 修改电脑名字为中文
    • 修改my.ini文档里面的文字为中文
    • 授权Beta 版: 使用 Unicode UTF-8 提供全球语言支持(U)
      等等,都不太行
  • 最终在这篇Blog的指导下解决了这个问题。
  • mysql的两个主要问题是
    1. 卸载不干净,这里我们使用Geek来卸载掉mysql的文件ProgramDataProgram Files两个位置的文件,文末有关于MySQL服务的删除方式。
    2. 缺少依赖项Microsoft Visual C++ 2013:这里我们使用微软常用运行库合集(Visual C++)2024.11.07来解决。

附录

  • 如何删除已经创建的MySQL91服务:
    使用注册表卸载服务
    使用Windows + R快捷键打开「运行」对话框,执行regedit打开注册表编辑器。导航到以下路径HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services,找到MySQL91删除即可。方法来自系统极客:4 种简单方法,帮你轻松删除 Windows 服务,我前两种方式没有尝试成功,第四种方式我没有尝试,因为不如第三种方式优雅。
  • 另一种安装方式
    笔者在问题解决之前是通过把从MySQL官网下载的解压包zip解压之后,根据这篇文档的教程配置初始化文件mysql.ini新建data文件夹也是可以使用的。
posted @ 2024-12-18 19:42  凉城深情Nemo  阅读(24)  评论(0编辑  收藏  举报