If you want to export just the records, omiting the auto-increment id column, you should do this trick:

mysqldump -u root -pYourPasword database table_name \  
  --compact --no-create-info | \
  sed -r "s/\([0-9]*/\(NULL/g"

There is NO native way to do that only using mysqldump. So, enjoy.

Note: For Mac OS X users, use sed -E instead of sed -r.

Blog Logo

Endel Dreyer

Full-stack developer. Loves Ruby and JavaScript.



bugfixer / @endel

About programming, tools and solving problems.

Back to Overview