Error Code 1051 Sql
Contents |
Closed Impact on me: None Category:MySQL Server Severity:S2 (Serious) Version:4.0.21 OS:Linux (Linux) Assigned to: Ingo Strüwing View Add Comment Files mysql error numbers Developer Edit Submission View Progress Log Contributions [28 Sep 2004 11:49] Egor mysql error php Egorov Description: In certain circumstances a DROP TABLE produces that error: #1051 - Unknown table 'produktkategorie_typ' User mysql sqlstate thinks it's because of the constraint, but then the error message is missldeadi ng. So basically he would need to disable the foreign_key_checks every time he drop a table
Mysql Error Message
which has constraints.. More in "how to repeat". How to repeat: Here is a small example: set foreign_key_checks=0; CREATE TABLE `produkt_kategorie` ( `pk_id` int(10) unsigned NOT NULL auto_increment, `pk_pt_id_typ` int(10) unsigned NOT NULL default '0', `pk_kategorie` varchar(255) default NULL, `pk_sortid` int(10) unsigned default NULL, PRIMARY KEY (`pk_id`), KEY `produk_kategorie_FKIndex1` (`pk_pt_id_typ`), CONSTRAINT `produkt_kategorie_ibfk_1` FOREIGN KEY (`pk_pt_id_typ`) REFERENCES `produktkategorie_typ` (`pt_id`) mysql error code 1062 ON DELETE NO ACTION ON UPDATE NO ACTION ) TYPE=InnoDB; CREATE TABLE `produktkategorie_typ` ( `pt_id` int(10) unsigned NOT NULL auto_increment, `pt_name` varchar(255) default NULL, `pt_sortid` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`pt_id`) ) TYPE=InnoDB; set foreign_key_checks=1; When I now try to drop the table produktkategorie_typ I get the error: #1051 - Unknown table 'produktkategorie_typ' [2 Oct 2004 22:55] Miguel Solorzano Tested against latest BK source on Linux and Windows. [12 Oct 2004 15:18] Ingo Strüwing The innodb table handler converts the innobase error code DB_CANNOT_DROP_CONSTRAINT to the MySQL error code HA_ERR_CANNOT_ADD_FOREIGN. This code is not handled in the DROP code and mapped to ER_BAD_TABLE_ERROR. Changing the handler conversion to HA_ERR_ROW_IS_REFERENCED makes the DROP code noticing the constraint. But the eror message is now: ERROR 1217: Cannot delete or update a parent row: a foreign key constraint fails. This is better, but may still be confusing. I need feedback on this from the bug reporter. [12 Oct 2004 15:20] Egor Egorov In my personal opinion, if this error gives gives a clue
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company mysql codes list Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Sqlstate Hy000 General Error
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Mysql Code Examples
like you, helping each other. Join them; it only takes a minute: Sign up drop table view, 1051 error up vote 3 down vote favorite Um, I'm cleaning up old DBs through phpmyadmin, and during the process https://bugs.mysql.com/bug.php?id=5784 forgot to DROP a view before dropping the related tables. I'm getting the #1051 unknown table error of course -- but how do I drop the view now? mysql share|improve this question asked Feb 17 '11 at 9:28 jodeci 3912617 add a comment| 1 Answer 1 active oldest votes up vote 5 down vote accepted By using DROP VIEW syntax from mysql. share|improve this answer answered Feb 17 '11 at 9:32 Sachin Shanbhag 32.4k65888 http://stackoverflow.com/questions/5027106/drop-table-view-1051-error Simple solutions are always the best! Thanks! (note to self: must learn more SQL) –jodeci Feb 17 '11 at 9:35 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged mysql or ask your own question. asked 5 years ago viewed 5527 times active 5 years ago Related 3Dropping a table in MySQL (3.23.58) with a special character in the tablename79Error Dropping Database (Can't rmdir '.test\', errno: 17)1Drop tables in MySQL369How to get the sizes of the tables of a mysql database?0DROP TABLE before view definition incorrect in mysqldump output92Schrödingers MySQL table: exists, yet it does not0Dropping database table0Mysql procedure drop table, error code 10540Can't DROP TABLE because unknown table (ERROR 1051)0Unable to create/drop a foreign key on a MySQL table Hot Network Questions Why is there a white line on Russian fighter jet's instrument panel? Asking Client for discount on Ticket to amusement park Etymology of word "тройбан"? Question on the Sato-Tate conjecture When stating a theorem in textbook, use the word
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/9373425/mysql-1051-unknown-table-userchat site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss http://en.community.dell.com/support-forums/servers/f/177/t/18062187 Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL - #1051 mysql error - Unknown table 'userchat' up vote 1 down vote favorite I have a local database that I need to drop and reload a new version in. The drop hanged for a long time, couldn't restart WAMP so I restarted my PC. Now the database is empty except for one table and it says - #1051 - Unknown table 'userchat' I've tried lots of ways error code 1051 to drop this table with no luck. eg: I tried myphpadmin gui stuff and drop table blah and drop database blah etc. Is there a trick to removing a database in this situation? I can remove and re-install WAMP if I need to. thx mysql corruption share|improve this question edited Feb 21 '12 at 7:10 biziclop 11.1k12750 asked Feb 21 '12 at 6:56 Adam 4,3521478131 can you repair/optimize the database? –biziclop Feb 21 '12 at 7:00 gonegr_db.userchat optimize Error Failed to read from the .par file gonegr_db.userchat optimize Error Incorrect information in file: '.\gonegr_db\userch... gonegr_db.userchat optimize error Corrupt –Adam Feb 21 '12 at 7:02 no I get corrupt on repair and optimize for the table... I'll look to see if I can do it on the database rather then table level –Adam Feb 21 '12 at 7:02 Can you drop the whole database? –biziclop Feb 21 '12 at 7:03 no I can't drop the database... error about the corrupt table... –Adam Feb 21 '12 at 7:04 | show 2 more comments 1 Answer 1 active oldest votes up vote 1 down v