To learn PHP, of course, you must first install the running environment. phpstyudy is an integrated environment for running PHP. One-click installation is very friendly to novices. At the same time, as a newbie, I followed the tutorial to install the phpstudy integrated environment. It can also be installed quickly. Really friendly to newbies.
But after installation, I encountered a trouble, that is, after Mysql is started, it will show that Mysql has stopped after a few seconds (I have solved this problem now, it should be a red box , don’t mind, /hehe). Restarted many times. Still can't start.
At this time, not only mysql in phpstudy cannot be started, but my original mysql cannot be started either. What should I do? I still have a lot of original data.
1. Cause Analysis
After searching for conflicts between phpstudy and mysql on the Internet, it turns out that both mysql occupy 3306 port, and the original mysql of the system will be started at startup (this is where the original mysql will be started as a service to start monitoring). Then when you open phpstudy, another mysql service will be started. At this time, because it is the same port, there will be a conflict. There are indeed people on the Internet who have encountered the same problem as me. They just delete the original mysql or modify the configuration file. Obviously, this solution is not what I want.
2. Solve the problem
So I wanted to try solving it this way. Will there be no conflict if I change the mysql port in phpstudy to 3307? I changed it. In theory, it can be successful, but it is still the same as before. Forget it, it’s too much trouble. Try another approach!
At this time, I want to uninstall mysql in phpstudy, but have I found the setting for setting the mysql path in phpstudy? If this plan doesn't work, think of another plan.
Then, I thought of moving the installed mysql to the mysql directory of phpstudy, and deleting all the files in the original mysql location. Will this allow phpstudy to use the original mysql database? I tried again, but still couldn't solve the problem. Because even if the mysql run file configuration file data file is moved in this way, the service in the computer management above is still starting the mysql service in the original location, and the mysql service file path specified by this mysql service cannot be modified. This plan will not work!
Let’s change our thinking again. This time I restored all the files deleted from the original mysql directory. Now the original mysql and the mysql folder of phpstudy have the same content, as shown below:
Select Replace All when moving.
To summarize, the solution is to copy all the files on the left side of the picture above directly to the right side of →_→~~~
Finally, after success Screenshot
If you have other questions about using phpstudy, you can go to the phpstduy module of the website to find the answer
The above is the detailed content of What should I do if the database service of phpstudy cannot start normally?. For more information, please follow other related articles on the PHP Chinese website!