Xampp MySQL 未启动 - “正在尝试启动 MySQL 服务...”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21279442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:53:18  来源:igfitidea点击:

Xampp MySQL not starting - "Attempting to start MySQL service..."

mysqlwindowsapacheinstallationxampp

提问by BeHaa

I've just installed XAMPP for Windows - should be the newest version (XAMPP Control Panel v3.2.1).

我刚刚为 Windows 安装了 XAMPP - 应该是最新版本(XAMPP 控制面板 v3.2.1)。

Apache is running just fine on port 80 and 443, but MySQL is not starting. When I press the start button, I get this message:

Apache 在端口 80 和 443 上运行得很好,但 MySQL 没有启动。当我按下开始按钮时,我收到以下消息:

Attempting to start MySQL service...

正在尝试启动 MySQL 服务...

Then a window pops up and asks me if I want to allow this, which I want. But nothing happens after that. I can press as many times as I want, but with the same result.

然后弹出一个窗口,询问我是否允许这样做,这是我想要的。但在那之后什么也没有发生。我可以按任意多次,但结果相同。

What can I do with MySQL?

我可以用 MySQL 做什么?

回答by suki ramachandran

If you have MySQL already installed on your windows then go to services.msc file on your windows and right click the MySQL file and stop the service, now open your XAMPP and start MySQL. Now MySQL will start on the port 3306.

如果您的 Windows 上已经安装了 MySQL,那么转到 Windows 上的 services.msc 文件并右键单击 MySQL 文件并停止该服务,现在打开您的 XAMPP 并启动 MySQL。现在 MySQL 将在端口 3306 上启动。

回答by Eoin

I had an issue with this because I had accidentally installed XAMPP to c:\windows\program files (x86)which caused a Windows permissions issue.

我遇到了这个问题,因为我不小心安装了 XAMPP,c:\windows\program files (x86)这导致了 Windows 权限问题。

The installation says not to install it there, but I thought it had said to install it there.

安装说不要在那里安装它,但我认为它已经说过要在那里安装它。

I uninstalled and reinstalled to c:\xamppand it worked.

我卸载并重新安装c:\xampp,它工作。

回答by Arghya

Only stop My sql In Xampp For 15 Min After 15 min restart Mysql .If my sql running But Port Not Showing in Xampp then Click Config > my.ini edit this file and change port no 3306 > 3307 and save and Restart xampp .........

仅在 Xampp 中停止我的 sql 15 分钟后 15 分钟重新启动 Mysql。如果我的 sql 正在运行但端口未在 Xampp 中显示,则单击配置 > my.ini 编辑此文件并更改端口号 3306 > 3307 并保存并重新启动 xampp ... ......

回答by Alok kumar

After Stop xampp, go to configure and change the port 3306 to 3308 of mysql and save. Now start the sql......Enjoy

停止xampp后,去配置并将mysql的3306端口改为3308并保存。现在启动sql……享受

回答by nguyendc

One of many reasons is xampp cannot start MySQL service by itself. Everything you need to do is run mySQL service manually.

众多原因之一是 xampp 无法自行启动 MySQL 服务。您需要做的就是手动运行 mySQL 服务。

First, make sure that 'mysqld.exe' is not running, if have, end it. (go to Task Manager > Progresses Tab > right click 'mysqld.exe' > end task)

首先,确保' mysqld.exe'没有运行,如果有,结束它。(转到任务管理器> 进度选项卡> 右键单击​​“mysqld.exe”> 结束任务

Open your services.msc by Run (press 'Window + R') > services.mscor 0n your XAMPP ControlPanel, click 'Services' button. Find 'MySQL' service, right click and run it.

通过运行打开 services.msc (按“窗口 + R”)> services.msc0n 您的 XAMPP ControlPanel,单击“服务”按钮。找到' MySQL'服务,右击并运行它。

回答by tao

Had this problem today, on a Windows 10 machine. Opened C:\xampp\data\mysql_error.logand looked for lines containing [ERROR].

今天在 Windows 10 机器上遇到了这个问题。打开C:\xampp\data\mysql_error.log并查找包含[ERROR].

Last error line was:

最后一个错误行是:

... [ERROR] InnoDB: File (unknown): 'close' returned OS error 206. Cannot continue operation

Important note: if your error is different, google it (you'll likely find a fix).

重要说明:如果您的错误不同,请使用谷歌搜索(您可能会找到修复方法)。

Searching for the above error, found this threadon Apache Friends Support Forum, which led me to the fix:

搜索上述错误,在 Apache 朋友支持论坛上找到了这个帖子,这让我得到了修复:

  1. Open C:\xampp\mysql\bin\my.iniand add the following line towards the end of [mysqld]section (above the line containing ## UTF 8 Settings):
  1. 打开C:\xampp\mysql\bin\my.ini并向[mysqld]部分末尾添加以下行(在包含 的行上方## UTF 8 Settings):
innodb_flush_method=normal
  1. Restart MySQL service. Should run just fine.
  1. 重启 MySQL 服务。应该运行得很好。

回答by surbaniak

  1. In the cmd type: services.mscFind MySql and change properties to the disabled.
  2. In the control panel of Xamppuninstall MySql by the checkbox on the left side, and install again by the click in the same checkbox.
  1. 在 cmd 中输入:services.msc查找 MySql 并将属性更改为禁用。
  2. 在控制面板中Xampp通过左侧的复选框卸载MySql,并通过单击同一复选框再次安装。

回答by Thomas

Windows 10 Users:

Windows 10 用户:

I had this issue too. A little bit of investigating helped out though. I had a problem before this one, that 3306 was being used. So what I found out was that port 3306 was being used by another program. Specifically a JDBC program I was trying to learn and I had xammp installed before I tried this JDBC out. So I deleted the whole file and then here I am, where you're at. The issue was that my 'ImagePath'(registry variable) was changed upon installing mySql again. To put it simply, xammp doesn't know where your mysqld.exe is at anymore, or the file is not in the location that you told it to be. Here's how to fix it:

我也有这个问题。不过,一些调查有所帮助。在此之前我遇到了一个问题,正在使用 3306。所以我发现端口 3306 正被另一个程序使用。特别是我试图学习的 JDBC 程序,在我尝试这个 JDBC 之前我已经安装了 xammp。所以我删除了整个文件,然后我在这里,你在哪里。问题是我的“ImagePath”(注册表变量)在再次安装 mySql 时发生了变化。简单地说,xammp 不再知道你的 mysqld.exe 在哪里,或者文件不在你告诉它的位置。以下是修复方法:

  1. Open run (Win + r) and type 'regedit'. This is where you edit your registry.
  2. Navigate to: HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > MySql
  1. 打开运行(Win + r)并输入“regedit”。这是您编辑注册表的地方。
  2. 导航到:HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > MySql

enter image description here

在此处输入图片说明

  1. Click on mySql and notice the ImagePath variable. Right click 'ImagePath' and click modify.
  2. Enter the location of your xammp mySqld file (navigate through xammp to find it) Although it is likely the same as mine.
  1. 单击 mySql 并注意 ImagePath 变量。右键单击“ImagePath”,然后单击“修改”。
  2. 输入您的 xammp mySqld 文件的位置(通过 xammp 导航以找到它)尽管它可能与我的相同。

Cool Sources:

很酷的来源:

https://superuser.com/questions/222238/how-to-change-path-to-executable-for-a-windows-service/252850

https://superuser.com/questions/222238/how-to-change-path-to-executable-for-a-windows-service/252850

https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html

https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html

Thanks dave

谢谢戴夫

回答by zeeshan

Only for windowsI have fixed the mysql startup issue by following below steps

仅适用于 Windows我已按照以下步骤修复了 mysql 启动问题

Steps:

脚步:

  1. Open CMD and copy paste the command netstat -ano | findstr 3306If you get any result for command then the Port 3306 is active

  2. Now we want to kill the active port(3306), so now open powershell and paste the command Stop-Process -Id (Get-NetTCPConnection -LocalPort 3306).OwningProcess -Force

  1. 打开 CMD 并复制粘贴命令netstat -ano | findstr 3306如果你得到命令的任何结果,则端口 3306 处于活动状态

  2. 现在我们要杀死活动端口(3306),所以现在打开powershell并粘贴命令 Stop-Process -Id (Get-NetTCPConnection -LocalPort 3306).OwningProcess -Force

Where 3306 is active port. Now port will be inactive

其中 3306 是活动端口。现在端口将处于非活动状态

Start Mysql service from Xampp which will work fine now

从 Xampp 启动 Mysql 服务,现在可以正常工作

Note:This works only if the port 3306 is in active state. If you didn't get any result from step 1 this method is not applicable. There could be some other errors

注意:这仅在端口 3306 处于活动状态时才有效。如果您在步骤 1 中没有得到任何结果,则此方法不适用。可能还有一些其他错误

For other ports change 3306to "Required port"

对于其他端口更改3306"Required port"

Ways to open CMD and Powershell

打开CMD和Powershell的方法

  1. For CMD-> search for cmd from start menu
  2. For Powershell-> search for powershell from start menu
  1. 对于 CMD-> 从开始菜单搜索 cmd
  2. 对于 Powershell-> 从开始菜单搜索 powershell

回答by Oltamor

Did you use the default installation path?

是否使用默认安装路径?

In my case, when i ran mysql_start.bat I got the following error:

就我而言,当我运行 mysql_start.bat 时,出现以下错误:

Can`t find messagefile 'D:\xampp\mysql\share\errmsg.sys'

I moved my xampp folder to the root of the drive and it started working.

我将我的 xampp 文件夹移动到驱动器的根目录,它开始工作。

Hope it helps

希望能帮助到你