Lei Mao bio photo

Lei Mao

Machine Learning, Artificial Intelligence, Computer Science.

Twitter Facebook LinkedIn GitHub   G. Scholar E-Mail RSS


I am learning PHP recently so I wanted to install MAMP on my laptop. The installation was successful. However, when I started to run MAMP, it raised the warning “mysql needs open port 3306 …” because MAMP uses MySQL. This reminded me that I have already installed MySQL on my laptop and the service was always running. Since I do not want to delete MySQL, I need to find a way to get MAMP and MySQL to stay peacefully together. One way to solve the problem is to use another port, other than port 3306, for MAMP. But I don’t like it. I want to assign the port to MAMP or MySQL whenever I want to use either one. Running MySQL constantly from Windows startup does not make sense to me, since it is only a laptop for the local test but not a service host.


I did some Google searches and found the solutions. To manipulate the Windows services, one has to run commands as administrator in the terminal (Right click the terminal and run as administrator).

The MySQL service name might be different from “MySQL”. To find out the MySQL service name, run the following command to find MySQL services among all the services.

sc query type= service

My MySQL service name is “Thinkpad-Mysql” (I configured it and later I forgot). To stop the service, run the following command.

net stop Thinkpad-Mysql

However, it is still not enough. Next time you start the computer, the “Thinkpad-Mysql” service will automatically run since startup. To prevent his, run the following command.

sc config Thinkpad-Mysql start= disabled

To restart “Thinkpad-Mysql” service, basically reverse the command we have run.

sc config Thinkpad-Mysql start= auto
net start Thinkpad-Mysql


I also tried to set the “Thinkpad-Mysql” service “manual” by running the following command.

sc config Thinkpad-Mysql start= manual

However, I failed. But the following command seems to work for “manual” (Check Microsoft Documentation).

sc config Thinkpad-Mysql start= demand

If the service becomes “demand”, it could be turned on or off by running single commands.

net start Thinkpad-Mysql


net stop Thinkpad-Mysql