SQL Dump - Wordpress doesn't recognize tables imported - mysql

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.

Related

How do I fix a mysql table that doesn't exist but thinks it does

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;

MySQL table(space) exists but can't discard

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

Remove corrupt table mysql phpmyadmin

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?

Code first strange table exists error

I use code first convention and mysql database in asp.net application. First I created a data model. Second I created database using add-migration and update database. I see in MySQLWorkbench that my database was created.
After that I run my app to see how database work. Before one of views is created I 'ask' database for a list of users. The problem is that during linq query to get list of users there is thrown an exception. Message is Table 'Events' already exists. I do not understand this error. Yes, all tables in the database exits. There is not direct relation between these to tables.
I have stared looking for the answer in the Internet. I found only one solution. I droped database, deleted all migrations, created new migration and update-database, but the this solutions does not solve the problem.
Any ideas?
This problem have number 1050 in MySQL.
In my Seed method I can insert objects into database, and it works. But during app is running the exception is thrown. I try:
DROP TABLE IF EXISTS Events;
REPAIR TABLE Events;
I execute this queries in MySQLWorkbench and restart the application. Then I have "new" exception that: "Table 'Documents' already exists". When I try
DROP TABLE IF EXISTS Documents;
REPAIR TABLE Documents;
MySQLWorkbench: Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint fails. So the problem still exists. Now I have exception "Table 'Documents' already exists". I check my Up method in migration class the first table which is created is Events, the second Documents. So I think that I should repair all tables, becouse in database-update command must create wrong database. But why it earlier works(?) I still do not know.

Magento re-index, cannot create table

I'm trying to re-index the category flat data, but I am always met with the same error:
There was a problem with reindexing process. Error Message: SQLSTATE[HY000]: General error: 1005 Can't create table 'xxx.catalog_category_flat_store_6' (errno: 121)
The table doesn't exist, there is a 1 and a 7. Not sure if that makes a difference?
After running the query manually through phpMyAdmin, I am met with the MySQL error 121. I've checked around and this would suggest the names of the foreign keys trying to be created already exist. I've listed all foreign keys in the DB right now, and they don't exist at all.
I've also tried running SHOW ENGINE INNODB STATUS on the DB for more information, but we don't have the rights to view that apparently.
After getting the priv's updated so we could run SHOW INNODB STATUS, we discovered that we already had an existing index that was attempting to be duplicated with this new table. This stemmed from us backing up an older version of the table that was trying to be created. Deleting that copy of the table enabled Magento to re-index properly and solved our problem.
Try logging the sql commands and debug what its trying to do by executing them manually. On the index process, normally there is a command that clears a table, and another to recreate it.
Edit /magentoRoot/lib/Varien/Db/Adapter/Pdo/Mysql.php and change $_debug to true and note the $_debugFile location (should be var/debug/pdo_mysql.log)
Its best to edit the file in vi, have a browser open to reindex JUST the category data, save the file in vi :w! and then run the indexer then change the debug back to false.
Then go read the log. It may help.