Detailed explanation of MySQL 5.7.9 shutdown syntax example

Detailed explanation of MySQL 5.7.9 shutdown syntax example

mysql-5.7.9 finally provides shutdown syntax:

Previously, if you wanted to shut down a MySQL database, you could use the kill command, mysqladmin shutdown, service mysqld stop, etc.

However, after mysql-5.7.9, mysql finally provides the shutdown syntax of the SQL interface!

The shutdown syntax under the SQL interface is:

grammar

shutdown ; -- For this shutdown command to be executed successfully, the shutdown permission is required.

An example of shutdown:

[root@workstudio ansible]# mysql -uroot -h127.0.0.1 -- Log in to mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> shutdown ; -- Execute shutdown through the SQL interface
Query OK, 0 rows affected (0.00 sec)
-- Execute system in the mysql client to execute the Linux command. Use ps here to check whether there is the mysqld service program on Linux. mysql> system ps -ef | grep mysql
root 5709 3403 0 13:32 pts/0 00:00:00 mysql -uroot -h127.0.0.1
root 5720 5709 0 13:33 pts/0 00:00:00 sh -c ps -ef | grep mysql
root 5722 5720 0 13:33 pts/0 00:00:00 grep mysql
-- From the results of ps, we can see that the mysql database has been closed (the mysqld process no longer exists)

If the permissions are insufficient, the following effects will appear:

mysql> shutdown;
ERROR 1227 (42000): Access denied; you need (at least one of) the SHUTDOWN privilege(s) for this operation

Since shutdown is an instance-level permission, the authorization statement is as follows:

mysql> grant shutdown on *.* to jiangle@'localhost';
Query OK, 0 rows affected, 1 warning (0.00 sec)
-- Grant shutdown permission to jiangle@'localhost' user

The above is a detailed explanation of the MySQL 5.7.9 shutdown syntax example introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Explanation of the basic syntax of Mysql database stored procedures
  • Detailed analysis of the syntax of Mysql update to modify multiple fields and
  • Detailed explanation of MySQL alter ignore syntax
  • Detailed explanation of the mysqlslap command and syntax for the built-in stress test in MySQL 5.7
  • Detailed explanation of MySQL syntax, special symbols and regular expressions
  • MySQL database basic syntax and operation

<<:  Implementation of code optimization for Vue2.x project performance optimization

>>:  Setting up a proxy server using nginx

Recommend

Tutorial on using Webpack in JavaScript

Table of contents 0. What is Webpack 1. Use of We...

CentOS 8 officially released based on Red Hat Enterprise Linux 8

The CentOS Project, a 100% compatible rebuild of ...

In-depth understanding of Vue-cli4 routing configuration

Table of contents Preface - Vue Routing 1. The mo...

Detailed explanation of the adaptive adaptation problem of Vue mobile terminal

1. Create a project with vue ui 2. Select basic c...

How to configure MySQL master-slave synchronization in Ubuntu 16.04

Preparation 1. The master and slave database vers...

Why is it not recommended to use index as key in react?

1. Compare the old virtual DOM with the new virtu...

MySQL implements an example method of logging in without a password

Specific method: Step 1: Stop the mysql service /...

HTTPS Principles Explained

As the cost of building HTTPS websites decreases,...

Solution to MySql Error 1698 (28000)

1. Problem description: MysqlERROR1698 (28000) so...

MySql5.7.21 installation points record notes

The downloaded version is the Zip decompression v...

Detailed explanation of keepAlive usage in Vue front-end development

Table of contents Preface keep-avlive hook functi...

Graphic tutorial on installing CentOS7 on VMware 15.5

1. Create a new virtual machine in VMware 15.5 1....

Summary of the characteristics of SQL mode in MySQL

Preface The SQL mode affects the SQL syntax that ...