Home  >  Article  >  Database  >  How to close mysql in centos

How to close mysql in centos

藏色散人
藏色散人Original
2023-02-16 10:21:243298browse

How to shut down mysql in centos: 1. Check the MySQL service through the "#chkconfig --list mysqld" command; 2. Use the "mysqladmin -p -u root shutdown" command to shut down mysql.

How to close mysql in centos

The operating environment of this tutorial: centOS6.8 system, MySQL5.7 version, Dell G3 computer.

How to close mysql in centos?

Starting and shutting down MySQL under Centos

1. Linux CentOS is generally used as a server, so the MySQL server should start randomly. Use the chkconfig command to view the services that start automatically after booting, as follows:

#chkconfig --list

Or just view the MySQL service

#chkconfig --list mysqld

You can see that mysql 2~5 is on, indicating The mysql service will start automatically when the machine starts.

2. Configure MySQL to start automatically at boot

chkconfig --add mysql
chkconfig mysqld on
3. Command to start/shut down the MySQL instance
service mysqld start/stop
/etc/init.d/mysqld start/stop
4. Command to shut down MySQL
mysqladmin -p -u root shutdown
5. Check whether mysql is actually started

Method 1: Query port

#netstat -tulpn

MySQL monitors TCP port 3306. The last line of the command operation result in the figure indicates that the MySQL service is running.

Method 2: Query the process

ps -ef | grep mysqld

If there are two processes mysqld_safe and mysqld, it means that the MySQL service is currently starting.

Recommended learning: "MySQL Video Tutorial"

The above is the detailed content of How to close mysql in centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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