Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Import error report when foreign key constraint exists in mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

After data backup through mysqldump, prompt for data recovery through mysql-uroot-p command:

ERROR 1215 (HY000) at line 72: Cannot add foreign key constraint

On import, the creation of data cannot be successful due to foreign key foreign key constraints between the data tables themselves.

Make the following settings on the mysql command line

Mysql > set @ @ global.foreign_key_checks = 0

The import still reports an error through the mysql-uroot-p command.

I couldn't try it a few times later.

Later, using the source command, no error was reported, and the import was successful.

After import is completed

Mysql > set @ @ global.foreign_key_checks = 1

Problem solved.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report