Saturday, June 19, 2010

Export or Import database to sql file with command line

How to quickly export/import sql file?, you can do that and use some tools here but i want to share about new experience, on this case i used the mysql commands. follow these steps:


1. Export database to sql file (create mysql dump file)
The easiest way to export use syntax command like this:

> mysqldump -u username -p database_name  > export_filename.sql




2. Import mysql dump file to database.
Make sure you have make the database name firstly, next you can use these command:

> mysql -u username -p database_name < export_filename.sql


hope helpful :)

No comments:

Post a Comment