Logo
Textual description of firstImageUrl

MySQL on Windows…port connection refused

image

I was trying to setup MySQL + PHP + Apache on Windows individually and tried to get it work. Installations went fine and below are the versions used for Apache, PHP and MySQL,

+ httpd-2.2.22-win32-x86-openssl-0.9.8t.msi (thread safe)

+ php-5.3.16-Win32-VC9-x86.msi

+ mysql-5.5.27-win32.msi (thread safe)

However, when I tried to connect to MySQL database, PHP scripts were not able to connect MySQL database. This was strange since everything seemed to be working fine.  I thought this was a problem related to firewall. But on system inspection, I could see that MySQL port 3306 (default) was not up

C:\>netstat -na | grep 3306

C:\>

After an hour of troubleshooting, I could identify the problem.

C:\>mysqladmin variables -u root -p | egrep "network|pipe"
Enter password: ***
| named_pipe                                        | ON             |
| skip_networking                                  | ON             |

C:\>

We can see above command output states that networking is OFF. What we need to do is to edit “C:\Program Files\MySQL\MySQL Server 5.5\my.ini” and set “skip_networking” flag to OFF either by commenting it in my.ini file or deleting it altogether. After saving my.ini restart MySQL service on Windows. And I could see port activated in netstat as below.

C:\>netstat -na | grep 3306
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING

C:\>mysqladmin variables -u root -p | egrep "network|pipe"
Enter password: ***
| named_pipe                                        | ON              |
| skip_networking                                  | OFF            |

C:\>

At last the process worked for me.


Don't be left Behind!
Sign up for daily updates delivered directly to your inbox.
Mandar Pise Opinions expressed by techsutram contributors are their own. More details

Mandar is a seasoned software professional & Fintech, Cloud, IoT, and Blockchain enthusiast. He writes to benefit others from his experiences. His overall goal is to help people learn about Fintech, Cloud, IoT, AI and Blockchain, and the effects they will have economically and socially in the future.

No comments:

Post a Comment

    Your valuable comments are welcome. (Moderated)


Instagram