There are two ways to end the MySQL process: the direct method uses the kill command, which is not recommended; the elegant method uses the mysqladmin command, which requires the user to have SHUTDOWN permissions and confirm termination by checking the process status. On Windows, you can use the taskkill command to forcefully end a process.
How to end the MySQL process
Direct method
can be used The following command directly ends the MySQL process:
<code class="shell">kill <进程 ID></code>
where<Process ID>
is the ID of the MySQL process.
Elegant method
In order to avoid data corruption, it is recommended to use the following elegant method to end the MySQL process:
Notification The MySQL server stopped running:
<code class="shell">mysqladmin shutdown</code>
Wait for the MySQL process to terminate:
Use the following command to check if the MySQL process is still running:
<code class="shell">ps -ef | grep mysql</code>
If the MySQL process no longer appears in the results, the process has terminated successfully.
Note:
On Windows, you can use the taskkill
command to end the process. The syntax is as follows:
<code>taskkill /pid <进程 ID> /f</code>
The above is the detailed content of How to end the mysql process. For more information, please follow other related articles on the PHP Chinese website!