mysqldump on FreeBSD
Just a few notes about mysqldump.
Create dump of mysql base:
# mysqldump -uDBUSER -pPASSWORD DBNAME > filename.sql
or
# mysqldump --user=username --password=password DBNAME > filename.sql
if you need to make dump of a few databases you can use parametr -B (or –databases):
mysqldump -uDBUSER -pPASSWORD -B DBNAME1 DBNAME2 > filename.sql
Make dump of the all Databases on host:
mysqldump -uDBUSER -pPASSWORD -A > filename.sql
If you need only dump structure of database (without data):
mysqldump -uDBUSER -pPASSWORD --no-data DBNAME > filename.sql
If you want to make limited by records mysqldump, next command especially for you (It was really cool command when I need dump and then move test copy of project with enormous mysql database):
mysqldump -uDBUSER -pPASSWORD --where="true limit 100" DBNAME > filename.sql
this command will dump your database with defined amount records in each table.
Posted on July 5th, 2011 by admin
Filed under: Development, Software, Tips