copy database structure without data in mysql (with empty tables)

前端 未结 6 1243
醉酒成梦
醉酒成梦 2021-01-31 02:36

Is there any way to copy database structure without data in MySQL, so the new database will be the same as it is copied from, but with empty tables.

After getting some s

6条回答
  •  终归单人心
    2021-01-31 03:12

    You can take backup using mysqldump and restore with mysql using commandline.

    For backup database

    $ mysqldump -u root-pPassword -P3309 --routines --no-data testdb > "d:\dbwithnodata.sql"
    

    For restoration of database

    $ mysql -u root-pPassword -P3309 newdb < "d:\dbwithnodata.sql"
    

提交回复
热议问题