Home > Database > Mysql Tutorial > body text

How to close mysql in centos

藏色散人
Release: 2023-02-16 10:21:24
Original
3302 people have browsed it

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
Copy after login

Or just view the MySQL service

#chkconfig --list mysqld
Copy after login

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
Copy after login
3. Command to start/shut down the MySQL instance
service mysqld start/stop
/etc/init.d/mysqld start/stop
Copy after login
4. Command to shut down MySQL
mysqladmin -p -u root shutdown
Copy after login
5. Check whether mysql is actually started

Method 1: Query port

#netstat -tulpn
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
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