【解决XAMPP MySQL服务与若依数据库端口冲突问题】
XAMPP的MySQL端口与若依冲突
问题描述
已经部署过若依的环境,现在要用XAMPP部署环境,但是XAMPP的MySQL服务启动不起来。显示端口占用。
报错信息
18:15:23 [main] Initializing Control Panel
18:15:23 [main] Windows Version: Enterprise 64-bit
18:15:23 [main] XAMPP Version: 7.4.29
18:15:23 [main] Control Panel Version: 3.3.0 [ Compiled: Apr 6th 2021 ]
18:15:23 [main] You are not running with administrator rights! This will work for
18:15:23 [main] most application stuff but whenever you do something with services
18:15:23 [main] there will be a security dialogue or things will break! So think
18:15:23 [main] about running this application with administrator rights!
18:15:23 [main] XAMPP Installation Directory: “e:\xampp”
18:15:23 [main] Checking for prerequisites
18:15:23 [main] All prerequisites found
18:15:23 [main] Initializing Modules
18:15:23 [mysql] Problem detected!
18:15:29 [mysql] Port 3306 in use by ““E:\MySQL\MySQL Server 5.7\bin\mysqld.exe” --defaults-file=“E:\MySQLData\MySQL Server 5.7\my.ini” MySQLRuoyi”!
18:15:29 [mysql] MySQL WILL NOT start without the configured ports free!
18:15:29 [mysql] You need to uninstall/disable/reconfigure the blocking application
18:15:29 [mysql] or reconfigure MySQL and the Control Panel to listen on a different port
18:15:29 [mysql] Attempting to start MySQL app…
18:15:29 [mysql] Status change detected: running
18:15:31 [mysql] Status change detected: stopped
18:15:31 [mysql] Error: MySQL shutdown unexpectedly.
18:15:31 [mysql] This may be due to a blocked port, missing dependencies,
18:15:31 [mysql] improper privileges, a crash, or a shutdown by another method.
18:15:31 [mysql] Press the Logs button to view error logs and check
18:15:31 [mysql] the Windows Event Viewer for more clues
18:15:31 [mysql] If you need more help, copy and post this
18:15:31 [mysql] entire log window on the forums
问题分析
通过这条日志我们可以发现是因为之前部署的若依占用了3306,导致XAMPP的MySQL服务无法启动,所以我们要在服务中找到若依的MySQLRuoyi服务,关闭他就好,我之前也是抱着试一试的心态尝试的。这条语句的应该是修改注册表里的MySQL信息,网上很多教程让你修改注册表的办法就是用的这种方式,但是若依也用了,所以你修改了也没用。
18:15:29 [mysql] Port 3306 in use by ““E:\MySQL\MySQL Server 5.7\bin\mysqld.exe” --defaults-file=“E:\MySQLData\MySQL Server 5.7\my.ini” MySQLRuoyi”!
解决方式
打开电脑的服务,找到MySQLRuoyi服务,如何打开可以自己百度,或者XAMPP右边有按钮可以直接打开按钮就在help的上面Services,然后找到MySQLRuoyi停止就可以了
停止之后可以试着在XAMPP里面打开MySQL服务试试,是不是好使了,
但是到这里只是完成了一半,我们要实现的是可以再切换回若依,
从XAMPP的MySQL切换到若依的MySQL
在退出XAMPP的时候一定要将MySQL服务Stop掉,不然若依的MySQLRuoyi启动不起来,
要想启动分离版若依后端需要将MySQLRuoyi启动起来,不然会报错
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
在服务中启动MySQLRuoyi成功后再次启动若依后台,即可启动成功。
结尾总结
这种方式比网上那些修改注册表这种手段要好很多,正确的方式往往就是简单的方式,越复杂越走越远。
更多推荐
所有评论(0)