php - Mysql cannot create foreign key error 121 but doesn't exists -
i have strange problem, i'm trying create foreign key specific name mysql says: "can't create table #sql-85f_169' (errno: 121)
" understand name must unique , is, because there no 1 name.
complete story: have 16 databases in 1 server (ubuntu server14) multiple web pages same structure, same tables, same different database name. add new database new client, make copy of of 16, download 1 , replace name of database , keep same structure. need add new foreign key table "orders", deleted 2 previous foreign keys, name "order_ibfk_1" , "order_ibfk_2" , added 3 more:
alter table `orders` add constraint `order_ibfk_1` foreign key (`id_reception`) references `recepction` (`id_recepction`), add constraint `order_ibfk_2` foreign key (`id_type_order`) references `type_order` (`id_type_order`), add constraint `order_ibfk_3` foreign key (`id_company`) references `company` (`id_company`);
i did on every of 16 databases , worked fine, not in new one, new database 17 show (errno: 121)
deleted foreigns keys, table empty, deleted entire table , make new 1 , keep saying same error. checked information_schema.table_constraints
, key_column_usage
not exist name "order_ibfk_1" in database. in show engine innodb status\g
section latest foreign key error
says duplicated name.
¿maybe in cache or something?, restarted service , server, happened on production server, on local worked fine. database , others 16 operational , working 24h cannot interrupt work every time.
i'm thinking in deleting database number 17 in first chance, later restore it. error #2013 - lost connection mysql server during query
when try run foreign key query, when working phpmyadmin or ssh on database 17, same query on others 16 not make error, use set @@global.max_allowed_packet = 1048576*10;
execute query same error 121. ¿any idea? ¿mysql haunted?
here did:
i downloaded database use in local, try run sql , goes fine.
so downloaded database, deleted on server, re-upload , run sql in server , sudenly works perfectly. guess in cache or memory.
Comments
Post a Comment