mySQL 和 XAMPP 的端口冲突

2022-01-14 00:00:00 xampp php mysql apache

我使用 XAMPP/Apache 已经有一段时间了,最​​近决定安装 MySQL.然而,它们似乎是矛盾的.MySQL 似乎优先考虑,并且它运行正常,但是 XAMPP/Apache 在尝试启动 Apache 时给了我这个错误消息:

I've been using XAMPP/Apache for a while and recently decided to install MySQL. However it seems that they are conflicting. MySQL seems to be taking preference, and it functioning correctly, however XAMPP/Apache is giving me this error message when attempting to start Apache:

03:07:32 AM  [Apache]   Attempting to start Apache app...
03:07:33 AM  [Apache]   Status change detected: running
03:07:33 AM  [Apache]   Status change detected: stopped
03:07:33 AM  [Apache]   Error: Apache shutdown unexpectedly.
03:07:33 AM  [Apache]   This may be due to a blocked port, missing dependencies, 
03:07:33 AM  [Apache]   improper privileges, a crash, or a shutdown by another method.
03:07:33 AM  [Apache]   Press the Logs button to view error logs and check
03:07:33 AM  [Apache]   the Windows Event Viewer for more clues
03:07:33 AM  [Apache]   If you need more help, copy and post this
03:07:33 AM  [Apache]   entire log window on the forums

我尝试按照此处的说明进行操作:http://www.complete-concrete-concise.com/web-tools/how-to-change-the-apache-port-in-xampp

I tried following the instructions here: http://www.complete-concrete-concise.com/web-tools/how-to-change-the-apache-port-in-xampp

我已经尝试更改文档:xampp/apache/conf 中的 httpd.conf

And I've tried changing the document: httpd.conf in xampp/apache/conf

将Listen 80"更改为各种内容,重新启动应用程序后出现相同的错误消息.

Changing 'Listen 80' to various things, and after restarting the application I had the same error message occur.

非常感谢您在此问题上的任何帮助.我不希望仅仅为了使用 XAMPP 而删除 mySQL,但如果它们无法同时运行,我会这样做.

Would greatly appreciate any assistance in this matter. I'd prefer not to remove mySQL just to use XAMPP, but will if there is no way for them to both operate simultaneously.

提前致谢.

我认为它与 MySQL 冲突的原因是:

My reason for believing it is conflicting with MySQL is this:

03:26:51 AM  [mysql]    Problem detected!
03:26:51 AM  [mysql]    Port 3306 in use by ""C:Program FilesMySQLMySQL Server 5.6inmysqld.exe" --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini" MySQL56"!
03:26:51 AM  [mysql]    MySQL WILL NOT start without the configured ports free!
03:26:51 AM  [mysql]    You need to uninstall/disable/reconfigure the blocking application
03:26:51 AM  [mysql]    or reconfigure MySQL and the Control Panel to listen on a different port

我在暂时禁用 mySQL 以使用 XAMPP/Apache 时遇到了一些困难.有什么办法可以改变端口,让它们可以共存?

I'm having some difficulties disabling mySQL temporarily to make use of XAMPP/Apache. Is there any way to change the ports so that they can co-exist?

编辑 2:

尝试按照此处的说明进行操作:http://silentlyrun.blogspot.com.au/2013/02/how-to-change-apache-n-mysql-port-for.html

Tried to follow instructions here: http://silentlyrun.blogspot.com.au/2013/02/how-to-change-apache-n-mysql-port-for.html

我遇到这些错误消息后:

I encounter these error messages after:

09:13:22 AM  [main]     Initializing Modules
09:13:22 AM  [Apache]   Problem detected!
09:13:22 AM  [Apache]   Port 80 in use by "Unable to open process" with PID 4084!
09:13:22 AM  [Apache]   Apache WILL NOT start without the configured ports free!
09:13:22 AM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
09:13:22 AM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port
09:13:22 AM  [Apache]   Problem detected!
09:13:22 AM  [Apache]   Port 443 in use by "Unable to open process" with PID 4084!
09:13:22 AM  [Apache]   Apache WILL NOT start without the configured ports free!
09:13:22 AM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
09:13:22 AM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port

根据这些说明,新端口应该相同吗?我假设是因为他们都是 80 岁.

With these instructions, should the new port be the same? I assume so because they are both originally 80.

4. Search the string "Listen" in the file.
5. Replace port number 80 to any other unused port number.
6. Search for "ServerName" in the file.
7. Replace port number 80 to any other unused port number in the ServerName.

编辑 3:

由于我不知道的原因,XAMPP/MySQL 在从上面的silentlyrun.blogspot 链接重新安装和端口更改后可以正常工作.但是 XAMPP/Apache 仍然存在问题:

For a reason unknown to me, XAMPP/MySQL works without issue after a reinstall and port change from the silentlyrun.blogspot link above. However XAMPP/Apache is still giving issues:

09:32:14 AM  [Apache]   Error: Apache shutdown unexpectedly.
09:32:14 AM  [Apache]   This may be due to a blocked port, missing dependencies, 
09:32:14 AM  [Apache]   improper privileges, a crash, or a shutdown by another method.
09:32:14 AM  [Apache]   Press the Logs button to view error logs and check
09:32:14 AM  [Apache]   the Windows Event Viewer for more clues
09:32:14 AM  [Apache]   If you need more help, copy and post this
09:32:14 AM  [Apache]   entire log window on the forums

推荐答案

要解决已经有另一个 MySQL Server 运行时的 MySQL Port 和 Service 冲突,您需要执行以下步骤:-

To Resolve MySQL Port and Service conflict when already another MySQL Server is running, you need to follow following steps:-

  1. 关闭 XAMPP 服务器

  1. Close XAMPP Server

打开文件C:xamppmysqlinmy.ini(C:是默认的XAMPP安装)

Open file C:xamppmysqlinmy.ini (C: is the default XAMPP Installation)

将端口号 3306 替换为 3307

Replace the port number 3306 with 3307

# password       = your_password  
port            = 3307
socket         = "C:/xampp/mysql/mysql.sock"

# The MySQL server
[mysqld]
port= 3307

  1. 保存文件并打开 XAMPP 控制面板(以管理员身份运行,否则将不允许以下更改)

  1. Save the file and open XAMPP Control Panel (Run as Administrator, otherwise it will not allow following changes)

在 XAMPP 控制面板中点击 Config >服务和端口设置

In XAMPP Control Panel Click on Config > Service and Port Settings

转到 MySQL 选项卡

将服务名称 mysql 更改为 mysqlxampp 并将主端口 3306 更改为 3307

Change Service name mysql to mysqlxampp and Main port 3306 to 3307

点击保存,然后保存并关闭 XAMPP

Click on Save then Save and close XAMPP

再次运行 XAMPP,您将能够启动 MySQL 服务器

Run Again XAMPP and you will be able to start the MySQL Server

您可能还面临 phpMyAdmin 的问题

You might also face issue with phpMyAdmin

你可以添加行

$cfg['Servers'][$i]['port'] = '3307';

在 phpMyAdmin 根目录下的 config.inc.php 文件中.

in your config.inc.php file in phpMyAdmin root directory.

相关文章