Additionally:
If you restore with SQLyog 'restore from SQL dump' the statement must be in the file itself. It will not do to execute from editor and next use 'restore from SQL dump' as 'restore from SQL dump' uses its own connection/session. Alternatively (if the script is not too large) paste the contents of the file into the editor.
If you back up with SQLyog there is a (default) option to add the statement SET FOREIGN_KEY_CHECKS = 0 on top. It will look like
Code:
/*!40014 [b]SET[/b] @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, [b]FOREIGN_KEY_CHECKS=0[/b] */;
— statements here
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
('bolded' SET FOREIGN_KEY_CHECKS=0 above)