Summary: in this tutorial, you will learn how to start MySQL Server on Windows and Linux.
Start MySQL Server on Linux
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)
“.
Start MySQL Server on Windows
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.
Summary
- Use the
sudo systemctl start mysql
command to start MySQL server on Linux. - Use the
net start <mysql_service>
command to start MySQL Server on Windows.