I have a corrupt table in my mysql db, that I want to remove.
It is a table that I do not use anymore, so it can be removed without any problems.
I already tried to repair the table, but then I get the following:
catalog_product_flat_1 repair Error Incorrect information in file: './catalog_product_flat_1.frm'
catalog_product_flat_1 repair error Corrupt
I can also not drop the table:
DROP TABLE catalog_product_flat_1
Unknown table 'catalog_product_flat_1'
How can I remove this table?
Related
There's a table in a database of mine, let's call it table_x, that used to get created and destroyed all the time. Now that's not happening, so the table should either exist or not, and actually it should not.
When I try to get a mysqldump of the database I systematically get this error:
Error: Couldn't read status information for table table_x ()
mysqldump: Couldn't execute 'show create table `table_x`': Table 'xxxxx.table_x' doesn't exist (1146)
Like mysqldump for some reason still thinks that the table exists and when it tries to dump it it triggers the error.
SHOW TABLES does NOT show the table.
However in information_schema.TABLES it's present.
I guess that's the problem, that information_schema somehow got out of sync with reality.
How do I "repair" this inconsistency?
I tried deleting the table with
DROP TABLE table_x
but unsurprisingly I get an error that the table doesn't exist.
To avoid such kind of error during drop a table it's a good habit to use IF Exist and IF NOT EXIST as:
DROP TABLE IF EXISTS table_x;
CREATE TABLE IF NOT EXIST table_x;
I've been trying hard to migrate a Wordpress project and after a thousand attempts, this is the closest I got. I notice that the tables I imported from my previous project are the ones that Wordpress can't reach. Then I thought it was a matter of adding the "56z7sj5c2a" suffix to the tables I moved. So I executed the code ALTER TABLE wp_options RENAME TO wp_56z7sj5c2a_options;, for example. It didn't work. Does anyone have any idea how I establish this link with the new tables? Below the message error after pressing the button "repair and optimize".
The wp_56z7sj5c2a_users table is okay.
Failed to optimize the wp_56z7sj5c2a_users table. Error: Table does not support optimize, doing recreate + analyze instead
The wp_56z7sj5c2a_usermeta table is okay.
Failed to optimize the wp_56z7sj5c2a_usermeta table. Error: Table does not support optimize, doing recreate + analyze instead
The wp_56z7sj5c2a_posts table is not okay. It is reporting the following error: Table 'djt443375729453.wp_56z7sj5c2a_posts' doesn't exist. WordPress will attempt to repair this table…
Failed to repair the wp_56z7sj5c2a_posts table. Error: Table 'djt443375729453.wp_56z7sj5c2a_posts' doesn't exist
The wp_56z7sj5c2a_comments table is okay.
The wp_56z7sj5c2a_links table is okay.
The wp_56z7sj5c2a_options table is not okay. It is reporting the following error: Table 'djt443375729453.wp_56z7sj5c2a_options' doesn't exist. WordPress will attempt to repair this table…
Failed to repair the wp_56z7sj5c2a_options table. Error: Table 'djt443375729453.wp_56z7sj5c2a_options' doesn't exist
The wp_56z7sj5c2a_postmeta table is not okay. It is reporting the following error: Table 'djt443375729453.wp_56z7sj5c2a_postmeta' doesn't exist. WordPress will attempt to repair this table…
Failed to repair the wp_56z7sj5c2a_postmeta table. Error: Table 'djt443375729453.wp_56z7sj5c2a_postmeta' doesn't exist
The wp_56z7sj5c2a_terms table is okay.
The wp_56z7sj5c2a_term_taxonomy table is okay.
The wp_56z7sj5c2a_term_relationships table is okay.
The wp_56z7sj5c2a_termmeta table is okay.
The wp_56z7sj5c2a_commentmeta table is okay.
Since I had some problems with my database, I tried to drop the database. When that didn't work, I removed my database folder in C:/xampp/mysql/data. I used SHOW TABLES and it said no tables in my database.
Now the problem is, first time importing my database dump file, I got the following problem:
ERROR 1050 (42S01) at line 2990: Table '`db`.`tbl`' already exists
I tried removing the table with the following query:
DROP TABLE tbl;
This gives the following error:
ERROR 1051 (42S02): Unknown table 'db.tbl'
However, I tried to create it with the following query:
CREATE TABLE tbl (id int NOT NULL PRIMARY KEY);
MySQL gives the following error:
ERROR 1813 (HY000): Tablespace for table '`db`.`tbl`' exists. Please DISCARD the tablespace before IMPORT.
I tried looking it up but I can't figure it out. Removing the .idb file causes the same problem eventually, I can't run ALTER TABLE tbl DISCARD TABLESPACE; because it'll give the error the table db.tbl doesn't exist.
Is there a way to fix this and what is the cause of it? I got these errors out of nowhere and it's frustrating
I have this problem with an table. i want to delete it and does not work
I tried to delete de .ibd file, them rename some frm file to the same name as te ibd to drop the table , does not work
when i drop table, and then create it again, it gives me this error #1813 table space for table name still exist, please discart tablespace before import. and if i try ti discard, says that nametable does not exist
I even tried to alter the table
I`m using xampp
does anyone knwo how to fix this?
In my case, I solve this with: DROP TABLE IF EXISTS yourtablename, yourtablename, yourtablename; and reload the db backup.
I use XAMPP in Osx,You can also see logs:
tail /Applications/XAMPP/xamppfiles/var/mysql/yourFile.local.err
You can also remove .ibd, I use XAMPP:
You should now work with your backup.
DROP TABLE logs/#sql-ib203 does not work due to /:
Error Code: 1064. You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '/#sql-ib203' at line 1
The table logs/#sql-ib203 appeared after a database crash (not enough disk space while re-indexing and deleting some attributes in a table in the logs database). SHOW TABLES does not list the table logs/#sql-ib203, but when trying to ALTER the table that was being changed during the crash MySQL complains about the existence of the table logs/#sql-ib203:
ERROR 1050: Table 'logs/#sql-ib203' already exists
SQL Statement:
ALTER TABLE logs.srv_logs DROP COLUMN filenum , DROP COLUMN
agent , DROP COLUMN ip , DROP COLUMN event_source
I use MySQL 5.6.12-winx64 and InnoDB.
Try to execute:
DROP TABLE `logs/#sql-ib203`
Need to wrap the name with ``, that should drop it.
Regards.
You can do a dump of your database, the orphaned innodb temporary table is not referred in the dump file, then you can drop the database and restore again.
Also you can try ; drop table #mysql50##sql-ib203;
Reference : http://dev.mysql.com/doc/refman/5.6/en/identifier-mapping.html