Error while restoring database using mysql folder

Asked

Viewed 886 times

0

Good morning, I lost a hard drive where my databases were, but I have backup of the banks' folders. I took the briefcase from one of the banks and put it in:

C: xampp mysql data

And he appears normally in mine phpmyadmin:

inserir a descrição da imagem aqui

Only when I click on any table it returns the following error:

#1932 - Table 'global.usuarios' doesn't exist in engine

I was told it might be something in ibdata1 only that this file from the old hard drive I can’t get anymore, would have some other way to attach that bank ?

Follows prints from the files: inserir a descrição da imagem aqui inserir a descrição da imagem aqui

1 answer

1


Please follow this at your own risk, I will not be responsible for further data loss!

If the corrupted table is not important your file . ibd (ibdata) can be removed. In your case I noticed that inside your folder c://xammpp/mysql/data/global there is no existence of.ibd users so just follow the steps below for mysql to try to generate a new file.

  1. First, you need to make another backup of your entire database directory (as data and files will be changed, errors can happen easily).

  2. Open mysql my.ini config file (in Notepad), and in the section [mysqld] add line:

    innodb_force_recovery = 1

    Save the file and try to start mysql.

    The value 1 above indicates which level of verification on mysql startup. The value goes from 1 to 6. Above 4 can be considered potentially dangerous, so we use the minimum value that is 1.

    This will put the database in a predominantly read-only mode (but you can still follow the DROP tables).

  3. If mysql starts open command prompt and connect to your mysql and try dump the table

    mysqldump -u root -p global usuarios > global.usuarios.sql
    

    The copy of the exported table above will contain only rows (tuples) of the table / that Mysql could read. (It is possible that no data can be recovered.)

    Then go to the Mysql shell, select the database with use database and give a drop on the corrupted table.

    mysql -u root -p
    use global; 
    drop usuarios;
    exit;
    
  4. Restart Mysql in normal recovery mode (undo my.ini edition) and reimport the "recovered" table. This table will contain only uncorrupted tuples. Probably some data will be lost.

If all goes well do a general check on the databases :

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases.

If the above procedures have no effect, you can choose to remove the.frm users file from within c://xammpp/mysql/data/global and start mysql normally. Perform a database check and then create the user table manually.

You can get more detailed information in the mysql manual Forcing Innodb Recovery.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.