MySQL is a free open source database management system that is widely used in Web application development. It is one of the most commonly used databases in Linux/Unix systems. This article will introduce how to start the MySQL service.
1. Start the MySQL service under the Linux system
It is very simple to start the MySQL service using the default command. Just use the following command. Available:
systemctl start mysql
This command is used to start the installed MySQL service. If MySQL is not installed on your system, you first need to install the MySQL service. Taking the Ubuntu system as an example, you can use the following command to install MySQL:
sudo apt-get update sudo apt-get install mysql-server
On some Linux distributions, you may need to use the service command to start MySQL service. On Debian and Ubuntu systems, you can use the following command:
sudo service mysql start
On CentOS and Fedora systems, you can use the following command:
sudo systemctl start mysqld
If your MySQL service is up and running, you can Close it through the following command:
sudo systemctl stop mysql
2. Start the MySQL service under Windows system
There are two different ways to start the MySQL service under Windows system:
If you choose to start the MySQL service manually, you need to manually start the MySQL service in the "Services" control panel. The steps are as follows:
1) Press the Win R key to open the run window, enter services.msc and press Enter.
2) In the Service Manager, search for the MySQL service, right-click it and select "Start".
You can also use the command line to start the MySQL service. Please follow the steps below:
1) Open the command line console, press the Win R key to open the run window, enter cmd and press Enter.
2) In the command line window, enter the bin directory of the MySQL installation path, such as: C:\Program Files\MySQL\MySQL Server 5.7\bin.
3) Type the following command to start the MySQL service:
mysqld.exe
The above command means starting the service and suspending the console. If you want to run the MySQL service in the background, you can use the following command:
mysqld.exe --install MySQL net start MySQL
After using the above command to start the MySQL service, the MySQL service will be automatically installed and run in the background.
Summary
In short, starting the MySQL service is relatively not difficult, just follow the system requirements and enter the commands correctly. Whether it is Linux or Windows, you can start the MySQL service through the command line or control panel.
The above is the detailed content of How to start mysql service. For more information, please follow other related articles on the PHP Chinese website!