PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0
RESTART This statement stops and restarts the MySQL server. It requires theSHUTDOWN privilege.
One use forRESTART is when it is not possible or convenient to gain command-line access to the MySQL server on the server host to restart it. For example,SET PERSIST_ONLY can be used at runtime to make configuration changes to system variables that can be set only at server startup, but the server must still be restarted for those changes to take effect. TheRESTART statement provides a way to do so from within client sessions, without requiring command-line access on the server host.
After executing aRESTART statement, the client can expect the current connection to be lost. If auto-reconnect is enabled, the connection is reestablished after the server restarts. Otherwise, the connection must be reestablished manually.
A successfulRESTART operation requiresmysqld to be running in an environment that has a monitoring process available to detect a server shutdown performed for restart purposes:
These platforms provide the necessary monitoring support for theRESTART statement:
Windows, whenmysqld is started as a Windows service or standalone. (mysqld forks, and one process acts as a monitor to the other, which acts as the server.)
Unix and Unix-like systems that use systemd ormysqld_safe to managemysqld.
To configure a monitoring environment such thatmysqld enables theRESTART statement:
Set the
MYSQLD_PARENT_PIDenvironment variable to the value of the process ID of the process that startsmysqld, before startingmysqld.Whenmysqld performs a shutdown due to use of the
RESTARTstatement, it returns exit code 16.When the monitoring process detects an exit code of 16, it startsmysqld again. Otherwise, it exits.
Here is a minimal example as implemented in thebash shell:
#!/bin/bashexport MYSQLD_PARENT_PID=$$export MYSQLD_RESTART_EXIT=16while true ; do bin/mysqldmysqld options here if [ $? -ne $MYSQLD_RESTART_EXIT ]; then break fidone On Windows, the forking used to implementRESTART makes determining the server process to attach to for debugging more difficult. To alleviate this, starting the server with--gdb suppresses forking, in addition to its other actions done to set up a debugging environment. In non-debug settings,--no-monitor may be used for the sole purpose of suppressing forking the monitor process. For a server started with either--gdb or--no-monitor, executingRESTART causes the server to simply exit without restarting.
TheCom_restart status variable tracks the number ofRESTART statements. Because status variables are initialized for each server startup and do not persist across restarts,Com_restart normally has a value of zero, but can be nonzero ifRESTART statements were executed but failed.
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0