I'm having problem with an error my MySQL database is giving me. Error: 1833. I cannot alter anything about a primary key on a table because mysql states:" Cannot change column 'idSubject: used in a foreign key constraint 'idSubject1' of table ''buntunovav1.semester1marks' and the problem with that error is that semester1marks is an old table I deleted a long time ago. It doesn't exist. When I show all tables, it doesn't exist. When I try to drop the table, MySQL itself states, that the table doesn't exist in the database. Any ideas what I should do?
Asked
Active
Viewed 106 times
0
-
1Are you sure you're looking in the correct database? – Barmar Aug 20 '15 at 21:02
-
`show databases;` `use dbname;` `show tables;` – Drew Aug 20 '15 at 21:17
-
@Barmar I'm very sure. In fact, there isn't a schema with that table. – Sello Nyama Aug 20 '15 at 21:17
-
You should probably ask for this question to be migrated to dba.stackexchange.com. They're more likely to know how to fix a database schema problem like this. – Barmar Aug 20 '15 at 21:21
-
@Drew I did that, but like I said, I'm very sure the table doesn't exist in any schema. Especially in the relevant one. – Sello Nyama Aug 20 '15 at 21:23
-
so somehow it has that FK reference to a table that does not exist – Drew Aug 20 '15 at 21:26
-
so you could create a new table, dump your data into it, delete the old table, rename the new one, assuming you can delete the old one without anything forbidding it (FK's) – Drew Aug 20 '15 at 21:27
-
@Drew.... I cannot drop a table that has a column referenced in another table, well, in this case... A table that doesn't exist. – Sello Nyama Aug 20 '15 at 21:40
-
copy the data to the new table. pretend the old table doesn't exist (abandon all references to it), like the 3rd mystery table ! Isolate and ignore, that's my motto – Drew Aug 20 '15 at 21:49
-
@Barmar how do I ask for that? – Sello Nyama Aug 20 '15 at 22:26
-
@SelloNyama Click on the "Flag" link. – Barmar Aug 20 '15 at 22:44
-
Try turning off foreign key checks, altering the table, then turning them back on. See http://stackoverflow.com/questions/15501673/how-to-temporarily-disable-a-foreign-key-constraint-in-mysql – Barmar Aug 20 '15 at 22:45