Start MySQL Server
To start MySQL Server on Linux, you follow these steps:
- First, open the Terminal program.
- Second, run the following command to start the MySQL service:
sudo systemctl start mysql
In this command, you need to replace the “mysql” with the actual service name if the MySQL service is different.
- Third, check the status and confirm that the service has started successfully, you run the following command:
sudo systemctl status mysql
If the MySQL service has started successfully, you should see “Active: active (running)“.
Typically, the MySQL installer installs the MySQL Server as a service on Windows and starts the MySQL Server automatically when the Windows operating system starts up. If this is not the case, you can start the MySQL Server using the following steps:
- First, open the Run dialog by pressing Windows+R keyboard shortcut.
- Second, type cmd and press Ctrl+Shift+Enter to run the Command Prompt as an administrator.
- Third, type the following command:
sc query mysql
In this command, mysql is the name of the MySQL service that you specified when setting up MySQL. You can replace it with the one on your server. This command shows the following output:
SERVICE_NAME: mysql TYPE : 10 WIN32_OWN_PROCESS STATE : 1 STOPPED WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0
The STATE line indicates that the MySQL Server is currently STOPPED.
- Finally, use the net start command to start the MySQL Server:
net start mysql
It’ll show the following output:
The MySQL service is starting. The MySQL service was started successfully.
Stop MySQL Server
If you install MySQL Server as a service on Windows, you can stop it as follows:
- First, press Windows+R to open the Run dialog.
- Second, input cmd and press Ctrl+Shift+Enter to run the Command Prompt as an Administrator.
- Third, type the following command to stop the MySQL Server:
net stop mysql
In this command, mysql is the name of the MySQL service. If you use a different service name, you must replace mysql with it. The command shows the following output:
The MySQL service is stopping. The MySQL service was stopped successfully.
To stop MySQL Server on Linux, you follow these steps:
- First, open a Terminal program.
- Second, run the following command to stop the MySQL service:
sudo systemctl stop mysql
In this command, you must replace mysql with the actual service name if your MySQL service is different. To check the status and confirm that the service has stopped, run the following command:
sudo systemctl status mysql
If you have stopped the service successfully, you should see “Active: inactive (dead)“.
Restart MySQL Server on Linux
You use the following command to restart the MySQL Server on Linux:
- First, open the Terminal program.
- Second, run the following command to restart the MySQL service:
sudo systemctl restart mysql.service
In this command, you need to replace the mysql.serivce service name with the actual one in your server.
- Third, check the status and confirm the mysql service has restarted successfully, you run the following command:
sudo systemctl status mysql.service
If the service has restarted successfully, you should see “Active: active (running)“.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.