title: Disable Constraints Temporarily
body: <p>I have many tables with relationship constraints. Tables contain full of dummy data, i would like to truncate/empty the data from the tables while keeping the structure.</p>
  
  <p>Everytime i want to empty a table, i get foreign key constraint errors. What can i do to disable the constraint temporarily and then set enable it back once dummy data are deleted. </p>
  
  <p>I tried this solution, but didn't work! Once i disable, then try to truncate, i get fk constraint error...</p>
  
  <pre><code>//disable
  SET FOREIGN_KEY_CHECKS = 0;
  
  
  //enable
  SET FOREIGN_KEY_CHECKS = 1;
  </code></pre>
  
  <p>I'm using MySQL.</p>
  
  <p>Any idea?</p>