复制数据库结构,不包含mysql中的数据(带有空表) [英] copy database structure without data in mysql (with empty tables)

查看:304
本文介绍了复制数据库结构,不包含mysql中的数据(带有空表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中没有任何方法可以复制没有数据的数据库结构,因此新数据库将与从中复制的数据库相同,但是具有空表.

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.

在获得一些建议后,我尝试了该命令,但出现语法错误,即username = rootpassword = nothing.我猜是默认的.我正在尝试遵循命令

After getting some suggestions I tried the command, but I am getting syntax error, my username = root and password = nothing. I guess the default one. I am trying following command,

mysqldump -u root -p -d xyz_db | mysql -u root -p -Dnew_db

我在命令中缺少什么或错位了?

what I am missing or misplacing in command?

推荐答案

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

新数据库必须已经存在. mysqldump命令中的-d标志可防止复制数据.

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

标志-p与密码之间没有空格.

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

这篇关于复制数据库结构,不包含mysql中的数据(带有空表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆