Skip to main content

Lost database after cpanel transfer

Comments

6 comments

  • psytanium

    While reviewing my notification emails, I noticed that I received an email five days ago informing me that a backup was unable to complete. Specifically about the account with missing database:

    [2024-01-03 02:43:37 +0200] mysqldump: Couldn't execute 'show fields from `wp_actionscheduler_logs`': Table './databaseuser/wp_actionscheduler_logs' is marked as crashed and should be repaired (145)

    The database was flagged as crashed, which explains why it couldn't be transferred to the new server and couldn't be restored on the old server either.

    Anyone have a solution please ?

    0
  • rbairwell

    In WHM, under SQL Services there is a "Repair a MySQL® Database" option which should help (there are command line tools to do this as well).

    If you don't have WHM access, you might be able to use `REPAIR TABLE wp_actionscheduler_logs` as an SQL command in a MySQLAdmin window.

    Alternatively, disable the ActionScheduler plugin in WordPress - delete the crashed table using MySQLAdmin or cPanel or WHM, and then re-enable the plugin - it *should* regenerate the table.

    Worst case - delete the crashed table, then recreate the table by hand using the data in https://github.com/woocommerce/action-scheduler/blob/trunk/classes/schema/ActionScheduler_LoggerSchema.php :

    CREATE TABLE wp_actionscheduler_logs (
                            log_id bigint(20) unsigned NOT NULL auto_increment,
                            action_id bigint(20) unsigned NOT NULL,
                            message text NOT NULL,
                            log_date_gmt datetime NULL default '0000-00-00 00:00:00',
                            log_date_local datetime NULL default '0000-00-00 00:00:00',
                            PRIMARY KEY  (log_id),
                            KEY action_id (action_id),
                            KEY log_date_gmt (log_date_gmt)
                            );
    0
  • psytanium

    Hi rbairwell

    Thank you for your response. The current problem lies in locating the database to initiate repairs. Unfortunately, I can't seem to locate it on either the new server or the old server.

    It appears that a broken database could not be transferred OR restored from a backup.

    My inquiry is twofold: Is there a method to restore an account that includes a broken database? Additionally, is there a way to identify and address the broken database within a transferred account? Any guidance on these matters would be greatly appreciated.

    0
  • cPRex Jurassic Moderator

    Do you have a backup of the account?  If so, do you see the bad database in the backup?  If you do, restoring the account would be the easiest solution.

    0
  • psytanium

    Yes I have backups on the old server. I can see the backups in Backup > Backup restoration.

    I tried to restore a backup but the bad database is not found.

    Maybe is there a way to download it as a sql file ? and restore it manually ?

    0
  • cPRex Jurassic Moderator

    It would be best to manually unzip the backups and confirm the database exists instead of trying to restore the backups.  It's possible that you don't have any backups that are old enough to contain the data.

    I'd find the oldest backup you have and see if the database is there first.

    0

Please sign in to leave a comment.