Here is a situation:
If you accidentally deleted some records from MySQL database and need to restore them, but not the entire database, here are the steps. In my case, I delete a WordPress user with 9 posts.
I did have a 3-day-old database backup. And I also have a backup/test server where the same, but older database is loaded.
(1) First, I would load the database backup from the latest backup into my test site. This step is well documented elsewhere.
(2) Then, I would export required records into a CSV file:
SELECT * FROM wp_users WHERE ID=169
INTO OUTFILE 'Q:\\T\\wp_users.csv'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
SELECT * FROM wp_usermeta WHERE user_id=169
INTO OUTFILE 'Q:\\T\\wp_usermeta.csv'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
(3) Finally I would transfer generated CSV files to a production server and import them into designated tables: