What should I do if navicat reports error 1025 when setting foreign keys? Let me give you an example below:
Example:
Change the member table id key to bigint: alter table member modify column id BIGINT;
The following is found during execution Error:
ERROR 1025 (HY000): Error on rename of '.\test\#sql-c68_10' to '.\test\member' (errno: 150)
Cause:
The id primary key field of the member table is the foreign key of another address. Modifying the id field type of the main table will cause the main table to be different from the foreign key. Key associated table fields are inconsistent.
Related recommendations: "Navicat for mysql graphic tutorial"
Solution:
(1) Find the external Key related table, find the foreign key name.
(2) Delete foreign key constraints.
(3) Modify the main table (member) id field type: alter table member modify column id bigint;
(4) Modify the auxiliary table (address) member_id field type: alter table address modify column member_id bigint;
(5)Add the deleted foreign key: alter table address add constraint fk_member_address foreign key (member_id) references member(id);
The above is the detailed content of What should I do if navicat reports error 1025 when setting foreign keys?. For more information, please follow other related articles on the PHP Chinese website!