无法启动MySQL,端口3306繁忙
我试图从 XAMPP(在 Windows Vista 下)启动 MySQL,但它说端口 3306 正忙。
检查哪个应用程序正在使用该端口以及如何释放它的最佳方法是什么?
I'm trying to start MySQL from XAMPP (under Windows Vista), but it's saying that's port 3306 is busy.
What would be the best way with check what application is using that port and how to free it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
只需打开任务管理器并杀死 MySql 服务即可。
Just Open task manager and Kill MySql service.
在命令 shell 中,运行:
并在第二列中查找显示
localhost:3306
的行。下面是使用该端口的应用程序的名称。In a command shell, run:
and look for a line that says
localhost:3306
in the second column. Below this is the application's name using the port.我遇到了同样的问题,并在这件事上停留了一天,但我无法在任何地方找到完美的答案。
所以我自己尝试了一下,结果成功了。此解决方案适用于 Windows 用户。我使用 Windows 7。
我的 xampp 控制面板显示错误,指出端口 3306 正忙并被某些文件使用(已指定名称).. 说“filename.de”。
现在按照以下步骤操作:
I had the same problem and was stuck on this thing for a day and I couldn't find a perfect answer anywhere.
So I gave it a shot on my own and it worked. This solution is for Windows users. I use Windows 7.
My xampp control panel was displaying an error that port 3306 is busy and in use by some file (name was specified).. say "filename.de".
Now follow the following steps:
我已经为这个错误困扰了好几个小时了。一段时间后我尝试从 XAMPP 运行 MySQL。它给出了错误,与你的类似,它说端口 3306 正在使用中。如果您:
netstat
看到任何使用 3306 端口的程序这是对我有用的解决方案:
更改适配器选项
我再次运行 MySQL,现在它可以工作了。
I've been having trouble for hours on this error. I was trying to run MySQL from XAMPP after quite some time. It gave errors, similar to yours, it said that port 3306 is in use. If you:
netstat
This is the solution that worked for me:
Open Network & Internet settings
Change adapter options
I ran MySQL again at now it works.
正如 @Segun Emmanuel 所提到的,运行以下命令:
您将获得使用不同端口的应用程序列表。按
Ctrl + F
并写入 3306 以找出哪个应用程序正在使用端口 3306。之后,通过搜索栏或按
CTRL + 转到任务管理器ALT + DEL
。然后在后台进程下,找到mysqld.exe
,右键单击它,你会发现一个关闭它的选项,即“结束任务
”。然后转到 Xampp 控制面板 并启动 MySQL 服务。
As Mentioned By @Segun Emmanuel Run the Following Command:
You will get a list of Applications that are using different PORTS. Press
Ctrl + F
and write 3306 to find out which Application is using PORT 3306.After this, Go to Task Manager via Search Bar or by pressing
CTRL + ALT + DEL
. Then Under the Background Processes, find outmysqld.exe
, right-click on it and you will find an option to close it, namely "End Task
".Then go to your Xampp Control Panel and start the MySQL service.
如果 mysql 没有在 xampp 中启动,则可能是端口冲突问题。 Mysql默认运行在3306端口,需要检查是否有其他应用程序占用了该端口。使用以下命令检查应用程序占用端口,
如果发现应用程序占用该端口,请停止该应用程序并重新启动xampp。作为替代方案,您可以转到 php.ini 文件或单击 xampp for mysql 中的配置并将 mysql 端口更改为 3307
If mysql is not starting in xampp, it might be a port conflict issue. Mysql run by default on port 3306. you need to check if another application is occupying that port. use following command to check app occupying a port
if you find an application occupying that port, stop the application and restart xampp. As an alternative, you can go to php.ini file or click configure in the xampp for mysql and change the mysql port to 3307
就我而言,它是在端口 3306 上启动的 javaw.exe。如果我在 Windows 10 中使用单用户登录,此 exe 不会导致问题。但如果我有多个登录,它会为每个用户启动此 exe 并阻止MySQL 在 3306 端口上启动。
转到任务管理器并为其他用户终止此 exe 修复了问题,并且 MySQl 可以启动。
In my case it was javaw.exe which was starting on port 3306. This exe does not cause problem if I am logged in using single user in my Windows 10. But if I have multiple logins, it starts this exe for each user and blocks MySQL to start on 3306 port.
Going to task manager and killing this exe for the other user fixed the issue and MySQl could start.
Windows 图标 ->打开cmd.exe。
输入
netstat -a -b
。找到它的用途。就我而言,是这样的:
因此,我转到任务管理器。没有这样的过程。我转到服务并禁用了这两个:
现在一切正常。
Windows icon -> Open cmd.exe.
Type
netstat -a -b
.Find what's using it. In my case it was this:
So, I went to task manager. There were no process called so. The I went to services and disabled these two:
Now everything works fine.
这个命令会杀死现有的 mysql 进程,也许可以重新启动它
它大多数时候都帮助我解决了这一挑战
This command kills the existing mysql process and perhaps one can start it afresh
It has helped me solve this challenge most of times
我遇到了这个问题(因为我使用的是 MAMP,略有不同)
我发现这个问题是由于安装了 MySQL Workbench,MySQL Workbench 在启动时启动了 mySQL 服务,这反过来又阻止了 MAMP 能够使用该端口。
为了解决这个问题,我有两个选择,
然后允许MAMP使用端口3306
I had this problem (slight variation as I was using MAMP)
I found this problem was due to having MySQL Workbench installed, MySQL Workbench started the mySQL service on bootup which in turn stopped MAMP being able to use the port.
To fix this I had 2 options,
This then allowed MAMP to use port 3306
如果你安装了两次mysql就会出现这个错误。 mysql 默认使用端口 3306。如果您安装了两次,那么您的端口号 3306 上已经有一个 mysql。因此您必须更改端口。
如果您使用 xampp,那么您可以轻松更改端口。更改端口步骤:
步骤1:以管理员身份打开你的xampp。
第 2 步:单击 xampp 右上角的“配置”。
步骤3:点击“服务和端口设置”,然后将mysql的主端口从3306更改为3307,然后点击保存。
步骤4:然后单击mysql前面的“config”并打开“my.ini”文件,该文件将是一个文本文件。
步骤 5:现在,在文本文件中的任何位置看到提到的端口号 3306,将其更改为 3307,然后保存文件。
再次执行此操作后,启动 mysql 服务器,它将开始在端口 3307 上运行。
这对我有用,我希望它对遇到相同问题的其他人也有用。
This error occurs if you have installed mysql two times. mysql by default uses the port 3306. If you have installed it twice then already there is a mysql at your port number 3306. So you will have to change your port.
If you are using xampp then you can easily change your port. Steps to change port:
Step 1: Open your xampp as administrator.
Step 2: Click on 'Config' at the top right corner of your xampp.
Step 3: Click on 'Service and Port Settings' and after that change the main port of mysql from 3306 to 3307 and the click on save.
Step 4: Then click on 'config' which is in front of mysql and open 'my.ini' file which will be a text file.
Step 5: Now wherever in the text file you see the port number mentioned as 3306 change it to 3307 and then save the file.
After doing this again start your mysql server and it will start running on port 3307.
This worked for me and I hope it will work for anyone else who encounters the same issue.
对于这个问题,在 Windows 上更简单的方法是: -
“停止”
For this problem, a simpler way on Windows is:-
"Stop"
如果您无法找到任何正在侦听端口
3306
的应用程序或进程,您可能需要检查您的网络适配器。禁用您不使用的适配器。
还要注意 Hyper-V 生成的网络适配器,如果不需要,请将其禁用。有时它会保留一些端口,而像
netstat
这样的命令将无法找到它If you where not able to find any application or process listening on port
3306
, you might need to check your network adapters.Disable adapters you do not use.
Pay also attention to the Hyper-V generated network adapter, disable it if you don't need it. Sometimes it can reserve some ports and commands like
netstat
will not be able to find it out我不确定这是否仅在最新版本的 XAMPP 上可用,但是
只需复制 XAMPP->MYSQL->BACKUP 中备份文件夹中的所有内容
并将所有内容粘贴到 XAMPP->MYSQL->DATA 的数据文件夹中,
这对我来说很有效。
I'm not sure if this is available only on the latest version of XAMPP but
just copy everything in the backup folder in XAMPP->MYSQL->BACKUP
and paste (replace everything) in your data folder in XAMPP->MYSQL->DATA
This did the trick for me.