Please read this article thoroughly before proceeding with the solution. Be sure to make server snapshot backups to avoid secondary failures.

Reason for appearing:
Under normal circumstances, when the database executes the query statement "Select * From Table_Name", it will normally return complete data to the user. When the query is executed, or the background operation of the InnoDB storage engine exits unexpectedly or is interrupted, it will cause InnoDB to roll back forward. Failed to restore data, the main error is displayed as follows:

Error 1:
2021-12-2306:50:44.061994Z 0 [ERROR] InnoDB: Page [page id: space=0, page number=448] log sequence number 453794788325 is in the future! Current system log sequence number 453794473178.
2021-12-2306:50:44.062002Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to ,
2021-12-2306:50:44.062039Z 0 [ERROR] InnoDB: Page [page id: space=0, page number=452] log sequence number 453794788552 is in the future! Current system log sequence number 453794473178.
2021-12-2306:50:44.062042Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to ,
2021-12-2306:50:44.062071Z 0 [ERROR] InnoDB: Page [page id: space=0, page number=457] log sequence number 453794788763 is in the future! Current system log sequence number 453794473178.
2021-12-23T06:50:44.062073Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to
2021-12-23T06:50:44.062159Z 0 [ERROR] InnoDB: Page (page id: space=0, page number=487] log sequence number 453794789850 is in the future! Current system log sequence number 453794473178.
2021-12-2306:50:44.062161Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to ,
2021-12-2306:50:44.062202Z 0 [ERROR] InnoDB: Page [page id: space=0, page number= 501] log sequence number 453794790288 is in the future! Current system log sequence number 453794473178.
2021-12-2306:50:44.062204Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to ,
2021-12-23T06:50:44.062223Z 0 [ERROR] InnoDB: Page [page id: space=0, page number= 514] log sequence number 453795083144 is in the future! Current system log sequence number 453794473178.
2021-12-2306:50:44.062225Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to
2021-12-2306:50:44.062234Z 0 [ERROR] InnoDB: Page (page id: space=0, page number=515) log sequence number 453795104290 is in the future! Current system log sequence number 453794473178.
2021-12-23T06:50:44.062236Z 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to ,
2021-12-23T06:50:44.062245Z 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of page (page id: space=0, page number=519]. You may have to recover from a backup.
2021-12-2306:50:44.062247Z 0 [Note] InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex fd121f7200000207000000000000000000000069a85032a0002000000000000000000000000000200383f700000206002c0000020800200751c821482b20000008ec93ae02f0000020200382461323833346164

Error 2:
2022-01-02 22:05:36 7f114f118720 InnoDB: Error: page 251 log sequence number 135630634
InnoDB: is in the future! Current system log sequence number 43744780.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: for more information.
2022-01-02 22:05:36 7f114f118720 InnoDB: Error: page 530 log sequence number 43789292
InnoDB: is in the future! Current system log sequence number 43744780.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: for more information.
2022-01-02 22:05:36 7f114f118720 InnoDB: Error: page 252 log sequence number 151634539
InnoDB: is in the future! Current system log sequence number 43744780.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: for more information.
2022-01-02 22:05:36 7f114f118720 InnoDB: Error: page 517 log sequence number 151634539
InnoDB: is in the future! Current system log sequence number 43744780.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: for more information.

The solution to this error is as follows:

1, First determine whether the error is consistent with the above error message, and then close the web service (Nginx, Apache, Openlitespeed).
2, Make a backup of the MySQL data storage directory. The backup is just in case. If there is a snapshot, try to make a disk snapshot.

The default database storage path in the panel is:
/www/server/data

Backup directory command:
\cp -rp /www/server/data \www\backup\data_2022

3, Add to the MySQL configuration file

The default MySQL configuration file for the panel is: /etc/my.cnf
innodb_force_recovery = 1

Restart the database after setting

innodb_force_recovery is a non-zero integer by default. There are a total of 6 parameter values 1--6. Refer to the official manual for parameter interpretation:
mysql 5.6
https://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
mysql 5.7
https://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
mysql 8.0
https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html

4,The above 6 parameter values, the latter contains the previous functions, such as parameter 3, which includes all the functions of parameter 1 and parameter 2. There is always one parameter here that can start the database. Note: If it cannot be started, please Clear the binary log (do not execute this command without backup):

rm -f /www/server/data/ib_*
rm -f /www/server/data/mysql-bin*

5, After restarting the database, back up the database as follows:

In the panel "Cron" set the backup database:

After setting, remember to click the "Execute" button, and pay attention to check whether the "Log" backup is successful. If the database is relatively large, the backup will take some time.
You can also back up by clicking the Backup button on the "databases" management interface.

6, When the backup is completed and there is no error, stop the database service, back up the database name, user name and corresponding password to Notepad and save it, and then uninstall the current database

7, After reinstalling MySQL, create a new database, use the database name, user name and corresponding password saved to Notepad, and pay attention to the character set used by the database

8, After restoring the latest backup database successfully, restart the web service and observe whether the website is normal.

Conclusion: The reason why the server is called a server is its strong stability and continuous service capabilities. Unless necessary, do not restart the server, usually do more data backup, and don't panic when there is a problem!
If you have trouble using the panel, you can post on the forum for help.

FAQ:

  1. Why shut down web services (Nginx, Apache, Openlitespeed)?
    A: At this time, MySQL has been unable to provide services normally. If the web service is always open, external access will keep requesting the database, and a large number of error logs will be generated. If the disk capacity is small, the disk space will soon be insufficient.

  2. Why do snapshots or backups?
    A: When processing data, MySQL may not be able to start due to special circumstances. If there is no backup or snapshot, the existing "data" will be damaged, causing secondary damage to the database.

  3. Why copy the database name, user name and corresponding password?
    A: To save time, creating a database on the panel will regenerate a random password. Currently, if the database information in your website is inconsistent with the information in the running database, you cannot connect. When creating a database, use the previous database name. , username and password to create a database, no need to modify the information in the website configuration file, so that it can be used directly after starting the web service

  4. What should I do if the database still fails to start after I have tried everything?
    Answer: MySQL's official solutions can't solve the current problem. It is recommended to find a professional data recovery company.

    a year later
    5 months later
    4 months later
    7 days later

    shajal This is a very easy task to fix

    1. First put your recycle bin on.
    2. Then delete your databases which will be stored in the recycle bin
    3. Now you uninstall mysql and install it again
    4. Then restart everything again
    4 months later

    Do not stop mysql at will, stable server hardware is running, etc.
    Daily backup database

      2 months later

      You need to stop mysql and then back it up. Note that it may not work properly even after the backup.
      If mysql is running normally, it is recommended that you back up the database directly in aapanel

      aaP_vikingphp

        aaPanel_Kern

        aaPanel_Kern Backup directory command:
        \cp -rp /www/server/data \www\backup\data_2022

        You told that i have to copy /www/server/data to /www/backup/data_2022,
        Now i want to use /www/backup/data_2022 but when i replace /www/server/data by /www/backup/data_2022 and change /www/server/data ownership to mysql:mysql and restart mysql, mysql stops working immediately. (error: Failed to start mysql service)

        mysql logs:

        2024-11-07T09:20:50.438804Z 0 [Warning] [MY-000081] [Server] option 'max_allowed_packet': unsigned value 107374182400 adjusted to 1073741824.
        2024-11-07T09:20:50.438931Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
        2024-11-07T09:20:50.439096Z 0 [System] [MY-010116] [Server] /www/server/mysql/bin/mysqld (mysqld 8.0.24) starting as process 3955312
        2024-11-07T09:20:50.461738Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
        2024-11-07T09:20:50.468074Z 1 [Warning] [MY-012197] [InnoDB] Unable to open './sys/sys_config.ibd'
        2024-11-07T09:20:50.830635Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_5.ibt' permission error, can't delete!
        2024-11-07T09:20:50.830764Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_10.ibt' permission error, can't delete!
        2024-11-07T09:20:50.830875Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_4.ibt' permission error, can't delete!
        2024-11-07T09:20:50.830987Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_9.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831098Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_2.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831209Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_8.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831325Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_1.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831443Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_6.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831566Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_3.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831686Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_7.ibt' permission error, can't delete!
        2024-11-07T09:20:50.831809Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 13 in a file operation.
        2024-11-07T09:20:50.831932Z 1 [ERROR] [MY-012595] [InnoDB] The error means mysqld does not have the access rights to the directory.
        2024-11-07T09:20:50.832047Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 13 in a file operation.
        2024-11-07T09:20:50.832161Z 1 [ERROR] [MY-012595] [InnoDB] The error means mysqld does not have the access rights to the directory.
        2024-11-07T09:20:50.832281Z 1 [ERROR] [MY-012126] [InnoDB] Cannot create file './#innodb_temp/temp_1.ibt'
        2024-11-07T09:20:50.832410Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
        2024-11-07T09:20:50.841845Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
        2024-11-07T09:20:50.842414Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
        2024-11-07T09:20:50.843045Z 0 [ERROR] [MY-010119] [Server] Aborting
        2024-11-07T09:20:50.845060Z 0 [System] [MY-010910] [Server] /www/server/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.24)  Source distribution.

          aaPanel_Kern I've changed the #innodb_temp folder chmod to 755 and the problem solved.
          But right now i have this error:

          mysql> check table accounts;
          No connection. Trying to reconnect...
          Connection id:    27
          Current database: uploader
          
          ERROR 2013 (HY000): Lost connection to MySQL server during query
          No connection. Trying to reconnect...
          ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)
          ERROR: 
          Can't connect to the server
          
          mysql> check table users;
          No connection. Trying to reconnect...
          Connection id:    8
          Current database: uploader
          
          +----------------+-------+----------+----------+
          | Table          | Op    | Msg_type | Msg_text |
          +----------------+-------+----------+----------+
          | uploader.users | check | status   | OK       |
          +----------------+-------+----------+----------+
          1 row in set (0.56 sec)

          @aaPanel_Kern