
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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)
Advertisements