This looks oddly familiar.
I have seen this occur with one of my web hosting client's DB servers. There was a particular table that crashed mysqld every single time you accessed it, even with SHOW CREATE TABLE
.
The problem stems from a corrupt data dictionary. There is really no way to correct it. You could attempt to alter the tablespace_id within the .ibd file but the headache stems from locating the tablespace_id list internal to ibdata1.
Even if you create a MyISAM table with the same name in the same database as the original InnoDB table, you cannot convert it to InnoDB because the tablespace_id is already associated with the table name. This, of course, is a corrupted state. It's like having a pidgeon hole in ibdata1 that you cannot patch up without some exploratory surgery.
You may have to mysqldump everything except the database that houses the corrupt table. You would then have to mysqldump every table in that database except the corrupt table. Remember, it is the data dictionary's view of the table that is screwed up, not necessarily the table's data.
The only sure way to clean everything up is to perform the mysqldumps as I just specified, shutdown mysql, rm -rf all DB folders except /var/lib/mytsql/mysql, delete ibdata1, delete ib_logfile0, delete ib_logfile1, startup mysql, reload all mysqldumps. See my StackOverflow post about cleaning up your InnoDB infrastructure.
Since you are not using innodb_file_per_table, any tables with this corrupt state of things within ibdata1 are lost as casualities of war. My condolences.
For future reference, click here to see an artistic conception of InnoDB and its Internals.
If you don't have backup.
I think the recommended way to recover that databases is start MySQL with innodb_force_recovery = 4 (or higher values) and dump the databases to a SQL.Then drop it and recover from backup. Instead of dropping the original database I prefer to create the new databases with another name or in another server and check the content first.
STEPS TO BE FOLLOWED
In mysqld section of my.cnf add a line innodb_force_recovery = 4
and then restart MySQL server using /etc/init.d/mysql restart
.
Take backup.
Restore it on other server and verify the contents.
Please also have a look at Forcing InnoDB Recovery.
UPDATE : For your comment how to progress on that so that it would not happen again
You should not kill MySQL it is not a good practice that may cause MySQL server to crash,whenever you make any configuration changes you should proceed as follows.
- Safely stop MySQL Server using
/etc/init.d/mysql stop
- Make changes
- Restart MySQL Server
Best Answer
I think performance of your server should improve as you have already set
innodb_file_per_table=1
and migrated bulky tables with this setting, so that all your large tables uses separateibdata
file for InnoDB operations.Also now onwards all new tables and existing migrated tables will use their own
ibdata
files instead of default system tablespace file which is 10G larger, hence performance should improve ....IMHO.InnoDB_file_per_table
has these advantages:You can back up or restore a single table quickly without interrupting the use of other InnoDB tables, using the MySQL Enterprise Backup product. See Restoring a Single .ibd File for the procedure and restrictions.
Storing specific tables on separate physical disks, for I/O optimization or backup purposes.
Restoring backups of single tables quickly without interrupting the use of other InnoDB tables.
Using compressed row format to compress table data.
Reclaiming disk space when truncating a table.