
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to restart MySQL server?
Restart the MySQL Server with the help of restart command.
The syntax is as follows
Restart
Let us first check the MySQL version.
The query is as follows
SELECT version();
Now, implement the above command in order to restart the MySQL Server.
The query is as follows
mysql> restart; Query OK, 0 rows affected (0.00 sec)
Case 1
Now, MySQL Server is being restarted. If you try to perform any query during the restart command, you will get an error.
The query is as follows
mysql> show databases; ERROR 2013 (HY000): Lost connection to MySQL server during query
Case 2
If the MySQL restart process is complete, then a new connection id will be assigned to MySQL.
The query is as follows
mysql> select version();
The following is the output
ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 8 Current database: sample +-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.05 sec)
- Related Articles
- How to copy tables or databases from one MySQL server to another MySQL server?
- How to find out port of MySQL Server?
- How to upgrade MySQL server from command line?
- How to Display System Variables of MySQL Server?
- MySQL Server and Server-Startup Programs
- How can I start MySQL Server?
- How can I shutdown MySQL Server?
- How to restart an Activity in Android?
- How to write a MySQL “LIMIT” in SQL Server?
- How to restart a remote system using PowerShell?
- How to Install and Configure MySQL on a Windows Server?
- MySQL Server port number?
- mysqld - The MySQL Server
- How can we get “MySQL server-side help”?
- How to restart a NoSQL Database service like MongoDB?

Advertisements