question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SET_FOREIGN_KEY = 0 or 1 not WorK

See original GitHub issue

when I have a table without an external key, just one drop table for delete table but if have constraint and use SET foreign_key_checks = 0; after of the query not work… error is

Cannot delete or update a parent row: a foreign key constraint fails

please help me I do not want to change package I’m fine with this

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthewJohnSymonscommented, Dec 27, 2018

Are you trying to disable foreign key checks so that it allows you to delete data? If so, I believe the command is:

SET foreign_key_checks = 0;

When you want to enable it again, it is simply:

SET foreign_key_checks = 1;

Hope this helps.

0reactions
dougwilsoncommented, Apr 17, 2019

I’m going to close this since it’s been lingering waiting for OP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'SET foreign_key_checks = 1' does not work again
It turns out that any rows you modified after “SET foreign_key_checks = 0;” will not be checked in the future, even after “SET...
Read more >
MySQL - Check or Not Foreign Key Constraints - SQLines
Syntax, SET FOREIGN_KEY_CHECKS = 0 | 1 ; Default, 1, Foreign keys are checked ; When Set to 1, Existing data are not...
Read more >
how to set foreign key - Vertabelo SA
1. Click on the reference. 2. Select PK column and FK column 3 Click "Add". ... I did not want to column name...
Read more >
how to set foreign key check to zero - Laracasts
So first you have to drop pivot tables or ones that have CONSTRAINTS and then main table. Example: Copy Code public function up()...
Read more >
how to SET FOREIGN_KEY_CHECKS = 0 in phpMyAdmin
I am trying to truncate some mySQL tables from phpMyAdmin web interface, but for foreign keys constraint I am not able to do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found