Skip to content

Instantly share code, notes, and snippets.

@kitzberger
Last active January 24, 2025 15:07
Show Gist options
  • Select an option

  • Save kitzberger/08925de43aecc679caf5482532f57bab to your computer and use it in GitHub Desktop.

Select an option

Save kitzberger/08925de43aecc679caf5482532f57bab to your computer and use it in GitHub Desktop.

export only inserts

mysqldump <db> <table> --skip-triggers --compact --no-create-info 

# with column names in INSERT statement
mysqldump <db> <table> --skip-triggers --compact --no-create-info --complete-insert

export only structure

mysqldump <db> <table> --skip-triggers --compact --no-data

export only some records

mysqldump <db> <table> --where='uid >= 100'

export with single inserts

mysqldump <db> <table> --skip-extended-insert

export not all columns

-- Create temp. table with only some columns
CREATE TABLE tt_content_alt AS SELECT uid,pid,CType,header,bodytext,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_stage FROM tt_content;
# Dump temp. table with column names in INSERT statement
mysqldump <db> <tt_content_alt> --complete-insert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment