Home > Database > Mysql Tutorial > body text

How to start and shut down MySQL

WBOY
Release: 2023-05-27 17:37:06
forward
999 people have browsed it

1. Start MySQL

There are two ways to start MySQL, one is to start using the command line, the other is to use the service to start .

1. Start using the command line

Enter the following command on the command line to start MySQL:

$ sudo systemctl start mysql
Copy after login

After successful startup, you can check the status of MySQL through the following command:

$ sudo systemctl status mysql
Copy after login
Copy after login

If the status is normal, "Active: active (running)" will be output, indicating that MySQL has been started successfully.

2. Use service startup

MySQL can also be started using service. This is the more common method because it can more conveniently manage the startup and shutdown of MySQL.

Starting MySQL using a service requires installing the MySQL service. You can install it through the following command:

$ sudo apt-get install mysql-server
Copy after login

After the installation is complete, you can start the MySQL service through the following command:

$ sudo service mysql start
Copy after login

2. Shutdown of MySQL

There are also two ways to shut down MySQL, one is to use the command line to shut down, the other is to use the service to shut down.

1. Use the command line to shut down

Enter the following command on the command line to shut down MySQL:

$ sudo systemctl stop mysql
Copy after login

After successful shutdown, you can check the status of MySQL through the following command:

$ sudo systemctl status mysql
Copy after login
Copy after login

If the status is normal, "Active: inactive (dead)" will be output, indicating that MySQL has been successfully shut down.

2. Use service to shut down

Using service to shut down MySQL also requires installing the MySQL service. If the MySQL service has been installed, you can use the following command to shut down the MySQL service:

$ sudo service mysql stop
Copy after login

The above is the detailed content of How to start and shut down MySQL. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template