MySQL is a popular open-source database used in Windows and Linux operating systems. MySQL is used as a service that can be started, stopped, or restarted via the command line interface. By default, the MySQL service is set to start when the operating system boots. But we can also start the MySQL server via the command line interface if it is not started.
Start MySQL via Command Line In Windows
The MySQL service is managed with the mysqld
command which can be used to start the MySQL database server. We can just call the mysqld command with the start
parameter in order to start the MySQL server in Windows operating systems.
> mysqld start
In some cases, the mysqld path is not configured properly and the upper command may not work. We can start the MySQL server by using the complete path of the mysqld command like below. Keep in mind that we assume that the current installed MySQL version is 8.0 and is located in the specified path.
> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" start
Start MySQL via Command Line In Linux
We can start the MySQL service via command line in Linux by using the systemctl
command. The systemctl command is used to manage services in Linux operating systems and distributions. Most of the modern Linux distributions support the systemctl command. The MySQL service is named as mysqld
and the start
is used for the start action for the MySQL service.
$ sudo systemctl start mysqld