Reputation: 379
I created an sql file from a binlog using this command:
mysqlbinlog --start-datetime="2024-02-22 00:00:00" --stop-datetime="2024-02-23 15:55:00" /var/lib/mysql/binlog.000096 > ./mysql-backup/binlog_96_data.sql
but when I tried to import the sql file in my I got this error:
mysql -uroot -p hp_temp_db < ./mysql-backup/binlog_96_data.sql
ERROR 1062 (23000) at line 46: Duplicate entry '5891044' for key 'visit_diagnosis.PRIMARY'
I even tried to use the --force flag, I could see the logs on the terminal,and when it seemed like all my 176 tables were populated, they were empty when I checked them:
mysql -uroot -p hp_temp_db --force < /mysql-backup/binlog_96_data.sql
ERROR 1062 (23000) at line 46: Duplicate entry '5891044' for key 'visit_diagnosis.PRIMARY'
ERROR 1062 (23000) at line 104: Duplicate entry '11543738' for key 'visit_prescriptions.PRIMARY'
ERROR 1062 (23000) at line 133: Duplicate entry '1591433' for key 'medicine_inventory.PRIMARY'
how can I work around the duplicate entry issue and get my tables to populated with data?
Upvotes: 0
Views: 207