0
votes

I am having problems with starting MYSQL in XAMPP. Apache starts alright but then MYSQL keeps reporting an unexpected shutdown.

I was led to delete C:\xampp\mysql\data\ibdata1 and it works after that but that deletes all my databases and MYSQL stops working again after I restart my machine.

I went through the error logs and this is what I saw:

[ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/innodb_index_stats uses space ID: 2 at filepath: .\mysql\innodb_index_stats.ibd. Cannot open tablespace yiicrud/customer which uses space ID: 2 at filepath: .\yiicrud\customer.ibd InnoDB: Error: could not open single-table tablespace file .\yiicrud\customer.ibd InnoDB: We do not continue the crash recovery, because the table may become InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it. InnoDB: To fix the problem and start mysqld: InnoDB: 1) If there is a permission problem in the file and mysqld cannot InnoDB: open the file, you should modify the permissions. InnoDB: 2) If the table is not needed, or you can restore it from a backup, InnoDB: then you can remove the .ibd file, and InnoDB will do a normal InnoDB: crash recovery and ignore that table. InnoDB: 3) If the file system or the disk is broken, and you cannot remove InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf InnoDB: and force InnoDB to continue crash recovery here.

3
How did you create/import the database 'yiicrud'?Salman
i created it in phpmyadmin on the same machineMichael Dugah
I experienced similar problem when I created a database in mysql 5.5 and then imported in mysql 5.6. The import worked ok but afterwards mysql wouldn't start. Had to downgrade mysql to 5.5 to continue the project :/Salman

3 Answers

1
votes

Adding this line in my.cnf worked for me:

innodb_force_recovery = 1
0
votes

There is a solution on this page: XAMPP/MySQL: could not open single-table tablespace file .\mysql\innodb_index_stats.ibd after restart of MySQL

Move (DON'T DELETE) those files, into another folder:

innodb_index_stats.frm <br>
innodb_table_stats.frm <br>
slave_worker_info.frm <br>
slave_master_info.frm <br>
slave_relay_log_info.frm <br>

and .ibd files with the same filename.

Try start MySQL.

0
votes

Thanks a lot everyone.

I have able to solve it. It appears the database was created in a later version and was incompatible with this new version of xampp so i created the databases again and imported the tables into them. Previously I was importing the database with the create statements as well.

Had the idea from Salman's comment.