Recover damaged MySQL database when you encounter the “MySL server is gone” error

MySQL is an open source database with a reasonable number of users around the world. It is fast, safe, reliable and easy to use. Besides being the most widely used open source database, it is an excellent option for the applications built on the LAMP platform (Linux, Apache, MySQL, PHP / Perl / Python). It runs efficiently on various operating systems such as Windows, Linux, Macintosh, Solaris, etc.

However, sometimes inconsistencies occur in the MySQL database that can lead to database corruption. The reasons behind such situations can be virus infections, human errors, abrupt system shutdown while the database is open, power surges, etc. In such cases, you should consider taking appropriate corrective action to resolve the problem. However, if you are unable to do this, you will need to use third party MySQL recovery software to restore the MySQL database.

Consider a scenario where you are working on a MySQL database. You are trying to run a query, but you cannot do it. In that case, one of the following error messages may be displayed:

MySQL server is gone

Lost connection to server during query

Cause:

There may be the following reasons for these error messages:

The server has timed out and is now disconnected.

You have disconnected yourself and are now trying to query the closed connection.

The client-side TCP / IP connection has timed out.

The server side has timed out and automatic client reconnection has been disabled.

You have asked a question that is too big or too complex.

However, if the above reasons did not cause the error message, it means that the MySQL database is corrupt.

Resolution:

To fix the problem, you can do one of the following methods:

If the connection is lost, re-establish the connection and see if it works properly.

Run the “OPTIMIZE TABLE” command. If you get the message “ERROR 1030 (HY000): Got error 28 from storage engine”, it would mean that there is no space in the drive to get the query result. Then, to restore the database by optimizing it, you need to perform the following steps:

Add the following line in the “mysqld” section in my.cnf:

“innodb_force_recovery = 4”

Quit “mysqld” and restore the data backup to the “mysqld” data folder.

Restart “mysqld” and perform a thorough check of your tables.

Try to do a big search.

Optimize all database tables.

However, if you are unable to recover the MySQL database using the above methods, then you will need to use a third party MySQL recovery tool. Such read-only tools can recover the MySQL database using fast but advanced scanning algorithms.

Stellar Phoenix MySQL Database Recovery is MySQL repair software that allows you to recover MySQL databases. This tool can fix MySQL components like tables, views, etc. It is compatible with Windows 7, Vista, Server 2003, XP and 2000.



Source by Manya Gupta