Tuesday, January 4, 2011


To dump a database
mysqldump -u {user} -p {-h hostname} {database name} > path.sql
mysqldump -u root -p -h xxxx.xxx.com xxxxx > xxxxx.sql

If you add a '-d' then only the schema is dumped and if you add a '-t'
just the data is dumped.

To import a database:
mysql -u {user} -p {database name} < path.sql
msyql -u root -p xxxxx < xxxxx.sql

If it's brand new install you may have to create the database first
mysql -u root -p -e "CREATE DATABASE xxxxx"

No comments:

Post a Comment