MySQL无法正常启动(mysqld ended) 的解决方案及环境变量配置

当MySQL服务启动失败,报错mysqld ended时,可以通过检查日志发现PID文件不存在。创建/var/run/mysqld/mysqld.pid文件并调整权限后,MySQL可以正常启动。但登录时遇到socket '/tmp/mysql.sock'不存在的问题,通过创建符号链接解决问题。最后,介绍了如何配置用户和系统环境变量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

启动mysql时报错: 

Starting mysqld daemon with databases from /var/lib/mysql 
STOPPING server from pid file /var/run/mysqld/mysqld.pid 
071112 00:22:06 mysqld ended 

 

1 首先查看日志

#less /var/log/mysqld.log 

其中有一段如下: 

071112 0:22:06 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2) 
071112 0:22:06 [ERROR] Can't start server: can't create PID file: No such file or directory 
071112 00:22:06 mysqld ended 

 

 

 

 

说明/var/run/mysqld/mysqld.pid不存在

 

2  创建上面没有的文件

#cd /var/run/ 
#ls 

mysqld目录不存在,创建它:&n

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 MYSQL800 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 MYSQL800 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. 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.41... Starting process with command: D:\MySQL\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1... D:\MySQL\bin\mysqld.exe (mysqld 8.0.41) initializing of server in progress as process 13404 mysqld: File '.\閼?bin.index' not found (OS errno 2 - No such file or directory) 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 D:\MySQL\bin\mysqld.exe: Shutdown complete (mysqld 8.0.41) MySQL Community Server - GPL. Process for mysqld, with ID 13404, was run successfully and exited with c
03-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ADreamClusive

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值