Error restoring database using mysql folder

0

Good morning,  I lost a hd where my databases were, plus I have the backup of the folders of the banks.  I grabbed the folder from one of the seats and put it in:

  

C: \ xampp \ mysql \ data

And it usually appears in my phpmyadmin :

ButwhenIclickonanytableitreturnsthefollowingerror:

#1932-Table'global.usuarios'doesn'texistinengine

Iwastoldthatitmightbesomethinginibdata1butthatoldhdfilecannotanymore,wouldyouhaveanyotherwaytoattachthisdatabase?

Followtheprintsofthefiles:

    
asked by anonymous 24.07.2017 / 07:36

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 .ibd (ibdata) file can be removed. In your case I noticed that inside your folder c://xammpp/mysql/data/global there is no existence of usuarios.ibd so just follow the steps below so that mysql tries to generate a new file.

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

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

      

    innodb_force_recovery = 1

    Save the file and try to start mysql.

      

    The value 1 above indicates which level of verification at 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).

  • If mysql starts open the command prompt and connect to your mysql and try make a dump of the table

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

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

    Next, access the MySQL shell, select the database with use database and give it a drop on the corrupted table.

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

  • If all goes well check out the databases:

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

    If the above procedures do not work, you can choose to remove the file Usuarios.frm from within c://xammpp/mysql/data/global and start mysql normally. Perform a check on the databases and then create the user table manually.

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

        
    24.07.2017 / 10:14