Trylinux.org
 

February 6, 2008

Dumping a mysql table to SQL

Filed under: General, linux, reminder, tips — tip @ 1:52 pm

I usually use phpMyAdmin to dump my table to SQL, but sometimes it is easier to do it from the command line. Use the following syntax to dump a table to SQL.

mysqldump -p -e -c --add-drop-table -r table.sql dbname table

Warning: The –add-drop-table will cause it to drop the existing table when you import.

You can import this with the command

mysql -p dbname < table.sql

1 Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment