Forum

mysql restore problem

Posted in CategoryGeneral
  • Marco
    Marco Dings   ( User ) 1 week ago

    Using mysql5.7 a database backup made using mysqldump fails because of errors on duplicate (foreign) key definitions

    When restoring i had to resort to a workaround based on a clean set of database tables generated by akaunting itself.

    Now instead of droping the tables and recreating them i truncate the respective tables and then insert the data.


    SET FOREIGN_KEY_CHECKS=0;


    LOCK TABLES `lxt_accounts` WRITE;

    TRUNCATE TABLE `lxt_accounts`;

    /*!40000 ALTER TABLE `lxt_accounts` DISABLE KEYS */;

    INSERT INTO `lxt_accounts` VALUES ......

    ( repeat this for all tables )

     

    in a typical mysql dump the TRUNCATE line is added, and the parts with te table droping and recreation are removed.



    Can anyone advise on a more sensible way of restoring a database ?

Please login or register to leave a response.