安装mysql 1042错误

日志:

Beginning configuration step: Writing configuration file
Ended configuration step: Writing configuration file

Beginning configuration step: Updating Windows Firewall rules
Attempting to delete a Windows Firewall rule with command: netsh.exe advfirewall firewall delete rule name="Port 3306" protocol=TCP localport=3306

已删除 1 规则。
确定。


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.
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: Starting Server
Attempting to start service MySQL80...
Failed to start service MySQL80.
Waiting until a connection to MySQL Server 8.0.11 can be established (with a maximum of 10 attempts)...
  Retry 1: Attempting to connect to Mysql@localhost:3306 with user root with no password...
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
Waiting 3 seconds before the next connection attempt...
  ......
  Retry 10: Attempting to connect to Mysql@localhost:3306 with user root with no password...
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
MySQL error 1042: Unable to connect to any of the specified MySQL hosts.
Failed to connect to MySQL Server 8.0.11 after 10 attempts.
Ended configuration step: Starting Server

 

 

重试10:正在尝试用用户根目录连接mysql@localhost:3306,但没有密码…

MySQL错误1042:无法连接到任何指定的MySQL主机。

MySQL错误1042:无法连接到任何指定的MySQL主机。

10次尝试后未能连接到MySQL Server 8.0.11。

结束配置步骤:启动服务器

 

没搞懂什么问题,只有把服务改成本地系统账户,就不报错了。

 

 

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 MYSQL90 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. Attempting to delete a Windows Firewall rule with command: netsh.exe advfirewall firewall delete rule name="Port 0" protocol=TCP localport=0 没有与指定标准相匹配的规则。 An error occurred running netsh.exe delete: The attempt to delete a Windows Firewall rule failed. Adding a Windows Firewall rule for MYSQL90 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.0.1... Starting process with command: D:\Program Files\MySQL\MySQL Server 9.0\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 9.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1... MySQL Server Initialization - start. D:\Program Files\MySQL\MySQL Server 9.0\bin\mysqld.exe (mysqld 9.0.1) initializing of server in progress as process 6204
最新发布
03-26
### 关于 MySQL 9.0 安装Windows 防火墙规则添加失败及 mysqld 初始化过程的问题 #### 一、Windows 防火墙规则添加失败的原因分析 在安装 MySQL 9.0 的过程中,可能会遇到无法成功添加防火墙规则的情况。这通常是因为以下几个原因: 1. **权限不足** 如果当前操作未以管理员身份运行,则可能导致防火墙规则无法正常添加。这是因为修改防火墙设置需要较高的权限级别[^1]。 2. **防火墙策略冲突** 当前系统的防火墙策略可能已经禁用了某些特定端口的访问规则,或者存在其他安全软件干扰了防火墙的操作[^4]。 3. **MySQL 服务未正确注册** 若 MySQL 服务未能正确初始化或注册到系统服务列表中,则防火墙规则也无法关联至该服务[^2]。 --- #### 二、解决方案:Windows 防火墙规则手动配置 如果自动添加防火墙规则失败,可以通过以下方式手动完成配置: 1. 打开控制面板中的“高级安全 Windows 防火墙”选项。 2. 创建入站规则并允许指定程序通过防火墙: - 程序路径应指向 `mysqld.exe` 文件所在位置(例如:`C:\Program Files\MySQL\MySQL Server 9.0\bin\mysqld.exe`)。 3. 或者创建基于端口的规则: - 添加 TCP 协议下的端口号 3306(默认 MySQL 数据库监听端口),确保外部连接能够到达数据库服务器。 --- #### 三、mysqld 初始化过程的问题与解决办法 mysqld 初始启动失败可能是由于多种因素引起的,以下是常见问题及其对应的处理方案: 1. **数据目录不存在** - 在首次启动 mysqld 之前,必须确认数据存储目录已正确定义并且具有写入权限。例如,在 my.ini 中定义的数据目录路径为 `C:\ProgramData\MySQL\MySQL Server 9.0\Data`,需提前创建此文件夹并赋予适当权限给 MySQL 用户组/账户[^3]。 2. **错误的日志记录** - 查看 error log 日志可以帮助定位具体问题。日志文件一般位于上述提到的数据目录下,默认名称类似于 `hostname.err`。通过阅读这些日志消息可以快速找到异常的根本原因。 3. **不兼容的依赖项** - 对于较新的操作系统版本,可能存在缺少必要的动态链接库 (.dll) 导致的服务崩溃现象。此时建议下载最新版 Visual C++ Redistributable Packages 并重新尝试初始化进程。 4. **重复实例化** - 使用命令行参数 `-initialize-insecure` 来初始化一个新的 root 密码时,请注意不要多次执行相同指令以免覆盖已有配置。 --- ```bash # 示例:初始化 MySQL 实例(无初始密码) mysqld --initialize-insecure --console ``` --- #### 四、综合调试流程 当以上单独措施仍不足以解决问题时,可按照如下顺序逐步排查: - 确认环境变量 PATH 是否包含 MySQL bin 路径; - 测试以最小化模式启动服务 (`net start mysql`); - 删除原有残留数据后再试一次完整的卸载重装步骤; --- ###
评论 22
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值