visible table does not exist in phpmyadmin - mysql

In mysqlworkbench, I created a view, committed it to the database, but I no longer needed it.
As such, I deleted the view in mysql workbench and then updated the database.
I thought all was fine, however in phpmyadmin, it says that the table still exists. What's more, it is constantly in use.
I tried to drop the table within phpmyadmin, however when I try to drop the table, it provides an error message saying:
1051 - Unknown table ... indicating to me that the table is not there.
but it still remains showing in the database, and under collation, it says that the table is 'in use'.
Any advice here?

Problem solved.
It appears as though you cannot delete a view from the database by normal means. The following solved the problem for me.
DROP VIEW IF EXISTS viewName;

Related

mysql: table disappeared. I have never dropped it

I was trying to drop a column of my table but I got an error message.
After a few attempts, suddenly the table disappeared, but I have never dropped it.
I was in the page "table structure" of phpmyadmin, I clicked "drop column" and an error message appeared, which told me "table doesn't exist".
This proves that I dind't drop it, because if I was working in the page table structure of the table it means that the table was there.
And I don't know what happened, seems totally irrational to me.
The table simply disappeared (autodropped) while I was working on it.
However, doesn't matter so much what happened. The question is: how can I restore the table? Given the fact that I didn't drop the table, maybe the table is still somewhere?
It's possible that the table was dropped and an error occured after the table got dropped. Double triple check in PHPMyAdmin, but I think your table has gone forever.
To prevent this happening in the future, always run daily backups on your site and store them in a location that's not on the server hosting your database.

Why am I getting a table doesn't exist error for a table that exists?

I am running a simple update statement:
UPDATE sometab
SET `somefield1` = '19',
`somefield2` = '3734941'
WHERE somefield3 = '1234';
and I am getting the error:
ERROR 1146 (42S02): Table 'prod._sometab_new' doesn't exist
I can successfully select from the table where somefield3 is 1234.
Why am I getting a table doesn't exist error for a table that exists? And why does the error message refer to a different table? I don't see any triggers associated with the table.
Additional information: A colleague just noticed that it is referring to a prod scheme, but the statement is running in a dev schema built from prod. The update statement works in DBs that were built a few days ago using the same method, but all of the DBs built after some, as of yet, unknown time exhibit the error.
The current theory is that a conversion script to move us to UTF-8 is currently running and creating tables like _ORIG_new as part of its conversion. We are going to wait for the conversion script to finish and then rebuild the dev databases and see if the error still persists.
Does this happen if you also try Insert into or Delete statements ?
Insert INTO sometab(somefield1, somefield2) VALUES (a, b).
If that works you should not have problems probably, otherwise you have problems accessing your database.
Second, are you sure you are using the correct database file and that are you connected to it properly. If you are using it in external application (c#), check your connection strings.
Also check how are you executing the query. I cant think of other more specific solution to your problem

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.

#1054 - Unknown column 'tidbitz' in 'field list'

Via phpmyadmin I dropped the column 'tidbitz' from a table.
Now any time I try to write to that table I get this error. The column is gone and it's not included in any of the queries that I am running. I know the syntax is correct for my queries. I can't even edit data using phpmyadmin, I still get this error.
I have tried: restarting the mysql server, restarting apache, defragmenting and optimizing the table...
Why is this ghost column sticking around?
Just encountered the same problem. In my case it was caused by an insert trigger that was running a query which was using the no-longer-existing column.
I ended up fixing my problem by creating another identical table, writing all of the data from table one to table two, dropping table one, and renaming table two to table one.
So, the problem is fixed, but I'm still curious to know if anyone has encountered this before and what the root cause is.
Thanks!

Table doesn't exist after CREATE TABLE

I'm trying to import this sql in my database name symfony
CREATE TABLE IF NOT EXISTS ingredient (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
and i get
#1146 - Table 'symfony.ingredient' doesn't exist
This seems rather odd since i'm trying here to CREATE this table, so... why is it not working ?
I've got the same problem if i try
CREATE TABLE symfony.ingredient
Or the feature in symfony 2
c:\Dev\Symfony>php app/console doctrine:schema:create
PS: I have this problem only with the new version of xampp.
EDIT
Well, i somehow managed to solve my problem.
I dropped my database, then created one (not with the interface) and finally i restarded mysql service.
I don't know why and how it unstuck me, but i hope this will help someone.
I had the same problem.
My solution:
Change table name in the create table query, exequte it and then rename the table.
Then, you can also drop this table and after it create it without getting error.
What worked for me was:
Going to the folder xampp/mysql/data/database-name/
You'll see only the .frm file. The files .MYD and .MYI are missing for empty tables.
Delete the .frm file.
Stop MySQL process and restart it.
After that I was able to create the table.
The old version of xampp created tables in MyISAM format the new version as InnoDB!
I had this same problem. I got a "server went away" message when creating the table and after that I was getting table doesn't exist messages, but I couldn't try to re-create the table because then I got a message saying that it did exist. I solved it by executing this at the command line:
mysqlcheck --repair --all-databases -u root -p
It also wouldn't hurt to restart the mysql server after this as well just in case.
Hmm, are you sure you have a database and are priviledged to do CREATE statements.
If you have phpmyadmin:
To test the first possibiblity, create a new (empty) test database, click it in the menu and
then press the SQL button in the top navigation and copy paste your statement again. If this doesn't work try the second.
For the second you can click on the 'home' button and then go to 'Privileges'. If there are only two or three accounts, but all with root privileges, you have the privileges to do a CREATE. Otherwise you can check your account and give yourself the privileges.
If both possibilities didn't work-out I don't know either. It worked fine for me :(
I had the same issue: #1146 - Table 'tutsplus_ci.posts' doesn't exist. I solved this issue following these steps:
I made an export of the incriminated table in a sql file. I noticed that the table name in the .sql file has a suplemental trailing space.
I switch back to phpmyadmin in Operations section of my table and I rename the table from ' posts' to 'posts'. After taken all these actions the error didn't show up.
To conclude, indeed the table 'posts' didn't exist as error message said. Because the the actual name of the table was ' posts' not 'posts'. The space before the name is hard to be notice in phpmyadmin. This is the story. Nothing special.
I hope it helps!
Go to the database in phpadmin and in sql drop the table .Then create the table.
may case in win & mac with case-insensitive fs
lower_case_table_names=1
reference https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_lower_case_table_names