Restoring a backup in Magento


/ Published in: MySQL
Save to your folder(s)

Wrap these two sets of commands around your sql backup if it hasn't come from a backup from the Magento admin interface (Magento adds this).

This stops foreign key checks and then restarts them.

The /*!40101 ---- */ code around the SET commands asks "If this version of mySQL is 4.1.1 or newer then run the SET command else do nothing." Older versions will not understand the statement.

This allows for easier compatibility with other versions of mySQL.


Copy this code and paste it in your HTML
  1. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  2. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  3. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  4. /*!40101 SET NAMES utf8 */;
  5. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  6. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  7. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  8. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  9.  
  10.  
  11. Your backed up sql goes here!
  12.  
  13.  
  14. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  15. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  16. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  17. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  18. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  19. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  20. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.