导入数据库架构 [英] Import database schema

查看:102
本文介绍了导入数据库架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个mysqldump文件,其中包含架构和数据转储。

I am having a mysqldump file which contains schema as well as data dump.

我需要从sqldump中仅导入数据库架构。我尝试使用以下命令:

I need to import only database schema from my sqldump. I tried with following command:

mysql -uUSER -pPASSWORD < filename.sql

但没有任何帮助。它同时导入模式和数据。

but of no help. it imports both schema as well as data.

我该怎么做?

推荐答案

恕我直言,最简单的解决方案是在常规文本编辑器中打开转储并将 CREATE TABLE ... 语句复制到另一个文件中。我甚至不关心做其他任何事情。

IMHO, the easiest solution is to just open the dump in a regular text editor and copy the CREATE TABLE ... statements into another file. I would not even care about doing anything else.

如果这不是一个选项,无论出于什么原因,你可以简单地创建一个新转储,这次是单独的结构和数据。两个文件。

If that's not an option for whatever the reason, you can simply create a new dump and this time separate structure and data in two files.

如果这也不是一个选项,你可以将转储加载到本地MySQL服务器从那里创建新的转储,或者使用像HeidiSQL这样的GUI工具来将结构直接传输到目标服务器。

If that's not an option either, you can load the dump into a local MySQL server create the new dump from there, or use a GUI tool like HeidiSQL to transfer the structure right into the destination server.

这篇关于导入数据库架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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