Skip to Content


MySQL related stuff.

mysqldump of latest 1000 records

Posted in

You can order and limit mysqldump output using the "--where" option. The --where condition below dumps the latest 1000 records from a table.

mysqldump --where="TRUE ORDER BY id DESC LIMIT 1000"

Here are some other examples.

mysqldump --where="TRUE LIMIT 500"
mysqldump --where="mailbox_id=45"
mysqldump --where="mailbox_id=45 AND TRUE ORDER BY id DESC LIMIT 300"

Replace Newline Characters With Commas Using tr, Not sed

I recently had a 5.0.9 Zimbra mailbox with inconsistencies between metadata (MySQL DB) and blob store (/opt/zimbra/store/...) in which the store was missing blob data referenced in the database.

Once I parsed the zmblobchk report data to retrieve information for the mailbox I wanted to fix, I wanted an efficient way to remove the blob item references from the database.

All commands run as zimbra user.

A snip from zmblobchk's mb8blobcheck.rpt file:

* MailboxGroup=8, mailbox=8, item=397: file not found: 397-2020.msg (delete associated metadata)

Syndicate content