如何在xampp服务器中运行MySql?

How to run MySql in xampp server?

如何解决这个问题?

我想用 php 代码连接 mysql 服务器。但是我尝试 运行 mysql 数据库服务时,我看到了这个错误。

17:45:11  [mysql]    Status change detected: stopped 17:45:11  [mysql]
Error: MySQL shutdown unexpectedly. 17:45:11  [mysql]    This may be
due to a blocked port, missing dependencies,  17:45:11  [mysql]
improper privileges, a crash, or a shutdown by another method.

17:45:11  [mysql]   Press the Logs button to view error logs and check

17:45:11  [mysql]   the Windows Event Viewer for more clues 17:45:11 
[mysql]    If you need more help, copy and post this 17:45:11  [mysql]
entire log window on the forums

也许你应该检查一下你的MySQL端口没有被占用,比如3306

你可以尝试一些事情-

尝试 运行 mysql 控制台,看看 mysql 是否工作正常。如果是这样,请尝试将其连接到 php 并执行您的代码

运行 xampp 作为管理员然后尝试 运行 mysql