简体   繁体   中英

Copied MySQL Database Files but Tables are not Showing in PhPMyAdmin

I recently tried to restore a Wordpress site using backed up files. I put my faith in the Wordpress "export-all content" function that in fact exports very little.

I kept backups of the WAMP files and have read several posts that successfully copy the backed up database files into the new location and the database works fine:

Reinstalled WAMP, Wordpress Tables Not Found BUT Are in PHPMYADMIN

Restore the mysql database from .frm files

The annoying thing is that these are not working for me. I have tried two things:

  1. Copied the database folder and the backed up ibfiles into the places. Once I do this and open PHP admin, the WP tables are listed but I get the error message that they do not exist. See the attached screenshot. 复制文件和问题的屏幕截图

  2. I created a new database with the same name and did a fresh wordpress install which created empty tables. I then copied the backed up folder containing the .frm files into the newly created folder and replaced the ib files. The problem this time is that WAMP would not start and I was denied access to PHPMyAdmin. Error message 2002 actively refused.

One thing I have noticed. In the backed up file the ibdata1 file had not been backed up since 13/08/14. Whereas the ib_logfile1 and iblogfile() were 29/03/2015 and 19/04/2015. Could it be possible that my backup program (WD Smartware) was not doing a sufficient job at backing up my files? If so am I wasting my time and should I just start rebuilding from scratch.

Thanks for your help.

Your ibdata1 file contains all your metadata for your database, tablespaces, indexes, table structure etc... It should always coincide with the last date that everything else was touched which appears to be 04/19/2015 for you. If your ibdata1 file has not been backed up since 08/13/2014 that means that all your metadata would be out of wack with your table ( .frm and .ibd ) files. So while you can see the tables in your database you cannot access the data because the tablespaces are completely misaligned. In which case you have the infamous case of Schrodinger's mysql table. Briefly explained, Mysql believes that the table exist and doesn't exist at the same time. I will refer you to this stackoverflow for more information.

I do not believe Innodb_force_recovery will work in your case but I guess it can't hurt to give it a shot. Percona has a recovery tool for innodb to fix metadata (tablespaces) that has become out of sync. You can give that a shot. From experience it is not easy to work with, you can only fire it up in linux, it is not necessary going to work, and there is very little on the web in terms of working with the tool.

My recommendation would be to scrap what you can and start over.

The problem might be related to the files permissions.

To verify, check database's folder permissions, by right click on your folder location in /var/lib/mysql/, and make sure the permission of the folder set to read and write and use by 'root'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM