Posted By

TheJasonParker on 01/21/11


Tagged

magento


Versions (?)

Restoring a backup in Magento


 / Published in: MySQL
 

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.

  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 [email protected]_SQL_MODE */;
  15. /*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;
  16. /*!40014 SET [email protected]_UNIQUE_CHECKS */;
  17. /*!40101 SET [email protected]_CHARACTER_SET_CLIENT */;
  18. /*!40101 SET [email protected]_CHARACTER_SET_RESULTS */;
  19. /*!40101 SET [email protected]_COLLATION_CONNECTION */;
  20. /*!40111 SET [email protected]_SQL_NOTES */;

Report this snippet  

You need to login to post a comment.