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

前端 未结 6 1225
醉酒成梦
醉酒成梦 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:02

    mysqldump -u user -ppass -d olddb | mysql -u user -ppass -D newdb
    

    The new database must already exist. The -d flag in the mysqldump command prevents copying of data.

    There's no space between the flag -p and the password.

提交回复
热议问题