Search code examples
mysqlampps

Some MySQL tables unaccessible after AMPPS update/reinstall


After a reinstall of AMPPS (upgrade failed, so I installed the new version over the old one, some config files fixed after new installation), some MySQL database tables seemed to have been lost. In phpMyAdmin I can only see some of them. I checked the database folder and found that I can see files for all of my tables - only some of them don't show up.

Example: Files for a table that is displayed in phpMyAdmin:

  • dbtable_ok.frm
  • dbtable_ok.MYD
  • dbtable_ok.MYI

Files for a table that is NOT displayed in phpMyAdmin:

  • dbtable_not_ok.frm
  • dbtable_not_ok.ibd

These latter files can also not be accessed by websites (especially Joomla).

This is the info about DB and Server from phpMyAdmin:

Database server

Server: localhost via TCP/IP
Server type: MySQL
Server version: 5.6.23 - MySQL Community Server (GPL)
Protocol version: 10
User: root@localhost
Server charset: UTF-8 Unicode (utf8)

Web server

Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.3.29 mod_wsgi/3.5 Python/2.7.9
Database client version: libmysql - mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325
PHP extension: mysqli Documentation

I hope that there is some simple setting in the config files to fix this ... Thanks!


Solution

  • Any hints or warnings in the MySQL error log?

    It's probably bad news for you. The reinstall probably overwrote your existing database. In particular, InnoDB tables are stored (by MySQL default) in the ibdata1 (and so on) file; this file is not portable between MySQL installations. What probably happened was that the new AMPPS installation installed a new set of databases which wiped out your existing database -- either just the metadata MySQL uses to keep track of it or the complete database.

    Now it looks like you've got an individual .ibd file, which means that all hope isn't lost. The instructions are rather complex and IMHO not suitable for copying and pasting here, but refer to the MySQL manual https://dev.mysql.com/doc/mysql-enterprise-backup/3.7/en/partial.restoring.single.html and this random site I just found http://www.chriscalender.com/recovering-an-innodb-table-from-only-an-ibd-file/ and perhaps one of them will help. This is where an error message from the MySQL startup may help determine exactly what's going wrong. Depending how old your backup is, it may be safer to just restore from backup.