Showing posts with label Mysql. Show all posts
Showing posts with label Mysql. Show all posts

Sunday, 15 February 2015

Mysql


1. Truncate table with foreign key constrain

     ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint 

       Disable foreign key constrain and truncate then enable foreign key constrain

           1. SET FOREIGN_KEY_CHECKS = 0;
           2. TRUNCATE TABLE TABLE_NAME;
           3. SET FOREIGN_KEY_CHECKS = 1;

2. Stop query execution while typo error in command prompt

     mysql>selct  -typo error
                 *
                 from
                 table_name
                \c
    clear the query execution