Showing posts with label import. Show all posts
Showing posts with label import. Show all posts

Saturday, March 26, 2011

Exporting and Importing mysql data using command line

To take db dump (export) use the following command. This will take the dump of the whole database

mysqldump -u
user_name -p database_name > dump.sql

To take backup of specific tables you can specify the table names like

mysqldump -u
user_name -p database_name table1 table2 > dump.sql

Now if you want to select some particular rows in a table u can use the following

mysqldump -u
user_name -p database_name table1 --where=condition > dump.sql

To import (restore) use the following command

mysql --user=
user_name --password=password database_name < dump.sql
Related Posts Plugin for WordPress, Blogger...