刪除外連接老是報(bào)錯(cuò)152,這個(gè)怎么解決
威她命willian陳威
2016-09-13 12:06:25
TA貢獻(xiàn)89條經(jīng)驗(yàn) 獲得超53個(gè)贊
檢查一下你的外健名有沒有寫錯(cuò) 曾經(jīng)這是MySQL的一個(gè)bug,但是現(xiàn)在只是MySQL的一個(gè)不友好的地方。 ????? 例子如下: ????? ALTER TABLE ruler.test2child DROP FOREIGN KEY test; ????? ERROR 1025 : Error on rename of './ruler/test2child' to './ruler/#sql2-298-8f' (errno: ????? 152) ????? 這里并不是不能刪除外鍵,而是使用了錯(cuò)誤的外鍵名稱,但是MySQL報(bào)的錯(cuò)實(shí)在離譜。 ????? 正確的錯(cuò)誤信息要如下查詢才能知道: ????show innodb status; ????? ------------------------ ????? LATEST FOREIGN KEY ERROR ????? ------------------------ ????? 071222 20:48:26 Error in dropping of a foreign key constraint of table ????? "ruler"."test2child", ????? in SQL command ????? ALTER TABLE ruler.test2child DROP FOREIGN KEY test ????? Cannot find a constraint with the given id "test". ? ? ? ? ? ? ? ? ? ? ? ? ? ?
舉報(bào)