[MySql] How to export MySql database schema using command line

Following command dumps MySql database's schema into a file:


mysqldump -u<username>i -p<password> -h<host> --databases <database1> --no-data > dump.sql

Above command exports single or multiple databases into dump.sql. This only exports database schema without any table contents.


This exported schema can be restored using following command:


mysql -u<username>i -p<password> -h<host> <database_name> < dump.sql

1 comment:

  1. Many thanks for your post.
    As I am newbie in Mysql, your post helped me a lot.

    ReplyDelete

Scheduling Repeating Local Notifications using Alarm Manager

Learn about Scheduling Repeating Local Notifications using Alarm Manager in this post .