Fix The Problem “LocalHost ERR_CONNECTION_REFUSED” in XAMPP as Set Up Local Dev Environment When Learning Ajax Basics

(Original) 用XXAMPP配置本地环境

Posted by KOKILI on June 21, 2021

First Error in XAMPP

Today I came across an error when I try to use the XAMPP to deploy the local server envirnment. Ajax Crash Course

The error shows as below:

1.png

Second Error ‘Port Occupied’

So I googled and someone says that “Make sure you started php and mysql from xampp control panel now on your browser”, and Indeed, I didn’t turn the mysql on. When I try to turn mysql in XAMPP on, another problem popped up which says ‘Port 3306 in use by “Unable to open process”!‘:

Snipaste_2021-07-13_19-19-31.png

Solution

Again, I rummaging around on StackOverflow to find the solution, and I found sth helpful:

Snipaste_2021-07-13_19-38-03.png Snipaste_2021-07-13_19-38-12.png

I tried this out in my CMD:

Snipaste_2021-07-13_19-39-40.png

And find one programme with PID (process Id) 6916, useful link explaining about PID: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/finding-the-process-id And finally I found the culprit mysqld.exe

Snipaste_2021-07-13_19-45-36.png

I finished it, and restart mysql in XAMPP, Then successed. The localhost problem alose solved!