Monday, September 19, 2011

Import and Export MySQL Database

Export command:


By using mysqldump — A Database Backup Program.


mysqldump -u username -p -h localhost dbname > dbname_exported_file.sql


Where -u : username
      -p : password
      -h : host name


By using the above command line, we can export database into the specified file.


Import command:


If we need to import to exported sql file.


mysql -u username -p -h localhost dbname < dbname_exported_file.sql


It imports all the queries into the database.


For references, check the URL http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html

No comments :

Post a Comment