Last Updated: February 25, 2016
·
913
· jaturken

Dump one record from mysql

Sometimes you want to copy one record from one database to another. For example, you find bug in production and want to reproduce it on your machine. You may dump buggy record from production database:

mysqldump -uremote_user -premote_password -hdatabase_host remote_database_name remote_table_name --where='id=1234' --skip-add-drop-table --no-create-info > ~/dump.sql

and insert it into you local database:

mysql -ulocal_user -plocal_password local_database_name < ~/dump.sql