Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

mysql restore problem

Marco Dings   ( User )

Commented 5 years 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.

Showing 1 to 1 of 1 discussions