无法启动MySQL,端口3306繁忙

发布于 2024-11-09 16:35:08 字数 98 浏览 0 评论 0原文

我试图从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

治碍 2024-11-16 16:35:08

只需打开任务管理器并杀死 MySql 服务即可。

Just Open task manager and Kill MySql service.

仙女山的月亮 2024-11-16 16:35:08

在命令 shell 中,运行:

netstat -b -p TCP

并在第二列中查找显示 localhost:3306 的行。下面是使用该端口的应用程序的名称。

In a command shell, run:

netstat -b -p TCP

and look for a line that says localhost:3306 in the second column. Below this is the application's name using the port.

夏雨凉 2024-11-16 16:35:08

我遇到了同样的问题,并在这件事上停留了一天,但我无法在任何地方找到完美的答案。
所以我自己尝试了一下,结果成功了。此解决方案适用于 Windows 用户。我使用 Windows 7。

我的 xampp 控制面板显示错误,指出端口 3306 正忙并被某些文件使用(已指定名称).. 说“filename.de”。

现在按照以下步骤操作:

  1. Ctrl+Alt+Del 并打开任务管理器。
  2. 打开“进程”列表并检查进程列表下的“显示所有进程”。如果您没有看到任何此类选项,请不要担心!因为有时需要管理员权限才能显示某些进程。
  3. 现在,当您单击“显示所有进程”按钮时,将显示所有进程。
  4. 现在,切换到任务管理器中的“服务”选项卡,将显示服务列表。现在查找名为“filename.de”的服务 <-- xampp 中错误消息中显示的文件名。
  5. 当您找到该服务时,“右键单击”,然后单击选项..“转到进程”。
  6. 您将被重定向到“进程”选项卡,重点关注与该服务对应的进程。 “右键单击”,然后单击“结束进程树”。
  7. 现在,问题已经解决了!但当您重新启动电脑时,可能需要再次执行相同的操作。因此,最好让您的电脑处于睡眠模式。
  8. 否则,要永久解决此问题,请打开“msconfig”并从服务列表中取消选中该特定进程,然后单击“应用”。然后您可以重新启动系统。

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:

  1. press Ctrl+Alt+Del and open Task Manager.
  2. Open the "Processes" list and Check for "show all processes" under the list of processes. If you don't see any such option, don't worry! as sometimes administrator permission is required to show some processes.
  3. Now, when you click on "show all processes" button, all the process will be displayed.
  4. Now, switch to "services" tab in the task manager, and a list of services will be displayed. Now look for a service named "filename.de" <-- filename that was diplayed in the error message in xampp.
  5. When you find that service, 'right-click', and then click in option.. GoTo Process.
  6. You will be redirected to the "Processes" tab with focus on a process corresponding to that service. 'Right-Click' and then click on "end process tree".
  7. Now, the issue has been solved! But might have to do the same thing again when you restart your PC. So it is best to keep your PC in sleep-mode.
  8. Otherwise, to solve this issue permanently, open "msconfig" and uncheck that particular process from the services list and click on apply. and you can restart your system.
风启觞 2024-11-16 16:35:08

我已经为这个错误困扰了好几个小时了。一段时间后我尝试从 XAMPP 运行 MySQL。它给出了错误,与你的类似,它说端口 3306 正在使用中。如果您:

  • 在 Windows 10 上运行
  • 正在避免将 MySQL 的端口号从 3306 更改为
  • 无法从 netstat 看到任何使用 3306 端口的程序
  • 重新安装并删除所有内容,但它仍然给出相同的
  • 错误启用和使用 Hyper-V
  • 所有其他解决方案都不起作用

这是对我有用的解决方案:

  • 转到任务栏最右侧,右键单击连接图标,单击“打开网络和网络”。 Internet 设置
  • 单击更改适配器选项
  • 右键单击​​并禁用与 Hyper-V 相关的所有内容

我再次运行 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:

  • are running on Windows 10
  • are avoiding to change the port number of MySQL from 3306
  • can't see any program using the 3306 port from netstat
  • reinstalling and deleting everything yet it still give the same error
  • are enabling and using Hyper-V
  • all of the other solutions didn't work

This is the solution that worked for me:

  • Go to the most right of the taskbar and right-click the connection icon, click Open Network & Internet settings
  • Click Change adapter options
  • Right-click and Disable everything that relates to Hyper-V

I ran MySQL again at now it works.

金兰素衣 2024-11-16 16:35:08

正如 @Segun Emmanuel 所提到的,运行以下命令:

netstat -a -b 

您将获得使用不同端口的应用程序列表。按 Ctrl + F 并写入 3306 以找出哪个应用程序正在使用端口 3306。

在此处输入图像描述

之后,通过搜索栏或按 CTRL + 转到任务管理器ALT + DEL。然后在后台进程下,找到mysqld.exe,右键单击它,你会发现一个关闭它的选项,即“结束任务”。

输入图片此处描述

然后转到 Xampp 控制面板 并启动 MySQL 服务。

输入图片此处描述

As Mentioned By @Segun Emmanuel Run the Following Command:

netstat -a -b 

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.

enter image description here

After this, Go to Task Manager via Search Bar or by pressing CTRL + ALT + DEL. Then Under the Background Processes, find out mysqld.exe, right-click on it and you will find an option to close it, namely "End Task".

enter image description here

Then go to your Xampp Control Panel and start the MySQL service.

enter image description here

向日葵 2024-11-16 16:35:08

如果 mysql 没有在 xampp 中启动,则可能是端口冲突问题。 Mysql默认运行在3306端口,需要检查是否有其他应用程序占用了该端口。使用以下命令检查应用程序占用端口,

Linux: netstat -tulpn | grep 3306
Window: netstat -a -b 
Mac: lsof -nP -i4TCP: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

Linux: netstat -tulpn | grep 3306
Window: netstat -a -b 
Mac: lsof -nP -i4TCP:3306

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

一江春梦 2024-11-16 16:35:08

就我而言,它是在端口 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.

岁月静好 2024-11-16 16:35:08

Windows 图标 ->打开cmd.exe
输入netstat -a -b
找到它的用途。就我而言,是这样的:
图片 1

因此,我转到任务管理器。没有这样的过程。我转到服务并禁用了这两个:

Image 2

现在一切正常。

Windows icon -> Open cmd.exe.
Type netstat -a -b.
Find what's using it. In my case it was this:
Image 1

So, I went to task manager. There were no process called so. The I went to services and disabled these two:

Image 2

Now everything works fine.

痞味浪人 2024-11-16 16:35:08

这个命令会杀死现有的 mysql 进程,也许可以重新启动它

sudo pkill mysql

它大多数时候都帮助我解决了这一挑战

1. Turn off the application which is using this port, open terminal and run "lsof -n -P -i | grep 3306" to figure out.
2. Use different ports, right click on the server -> Edit.

This command kills the existing mysql process and perhaps one can start it afresh

sudo pkill mysql

It has helped me solve this challenge most of times

1. Turn off the application which is using this port, open terminal and run "lsof -n -P -i | grep 3306" to figure out.
2. Use different ports, right click on the server -> Edit.
呆头 2024-11-16 16:35:08

我遇到了这个问题(因为我使用的是 MAMP,略有不同)

我发现这个问题是由于安装了 MySQL Workbench,MySQL Workbench 在启动时启动了 mySQL 服务,这反过来又阻止了 MAMP 能够使用该端口。

为了解决这个问题,我有两个选择,

  1. 卸载MySQL Workbench
  2. 打开任务,单击服务选项卡,终止当前的MySQL服务

然后允许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,

  1. Uninstall MySQL Workbench
  2. Open Task, click services tab, kill the current MySQL service

This then allowed MAMP to use port 3306

旧情勿念 2024-11-16 16:35:08

如果你安装了两次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.

倾城°AllureLove 2024-11-16 16:35:08

对于这个问题,在 Windows 上更简单的方法是: -

  1. 转到任务管理器
  2. 转到服务
  3. 将会出现一个名为 MySQl80 的服务,右键单击它,然后选择
    “停止”
  4. 尝试再次启动 XAMPP 服务器上的 MySQl 模块

For this problem, a simpler way on Windows is:-

  1. Go to Task Manager
  2. Go to Services
  3. There will be a services named MySQl80 right click on it and then select
    "Stop"
  4. Try and start the MySQl module on XAMPP server again
ぶ宁プ宁ぶ 2024-11-16 16:35:08

如果您无法找到任何正在侦听端口 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

蓝颜夕 2024-11-16 16:35:08
  1. 使用管理员运行 XAMPP
  2. 如果您已经安装了 MySQL 服务,请将其卸载并重新安装。如果您尚未安装,请安装 MySQL 服务。
  1. Run XAMPP with Administrator
  2. If you already installed MySQL Service, Uninstall it and install again. If you not already install it install MySQL Service.
夜唯美灬不弃 2024-11-16 16:35:08

我不确定这是否仅在最新版本的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文