如何在重命名某些表/列而根本不导入其他表/列的同时导入mysql dump? [英] How to import a mysql dump while renaming some tables/columns and not importing others at all?

查看:67
本文介绍了如何在重命名某些表/列而根本不导入其他表/列的同时导入mysql dump?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要将旧版数据库导入程序的新版本,我想知道是否有一种方法可以不从转储中导入某些列/表,而是在导入它们时重命名其他表/列?我知道我可以在理论上编辑转储文件,但是这似乎是一种hack,到目前为止,我的所有编辑器都无法打开1.3 gb文件(是的,我已经在此处阅读了有关该文件的问题.到目前为止,没有一个答案对我有用.

I'm importing a legacy db to a new version of our program, and I'm wondering if there's a way to not import some columns/tables from the dump, and rename other tables/columns as i import them? I'm aware I could edit the dump file in theory, but that seems like a hack, and so far none of my editors can handle opening the 1.3 gb file (Yes, I've read the question about that on here. No, none of the answers worked for me so far.).

建议?

推荐答案

通过拒绝权限并使用--force作为命令行选项,可以不导入某些表.

It's possible to not import some tables by denying permissions to do so, and using --force as a command line option.

不导入某些列或重命名它们是不可能的(至少在不编辑转储文件或导入后进行修改的情况下).

Not importing some columns, or renaming them is not possible (at least without editing the dump file, or making modifications once imported).

我的建议是:

  • 将表导入另一个数据库(1.3G应该仍然非常快).
  • 进行掉线/重新命名.
  • 导出数据以创建一个新的转储文件.

如果您担心转储包含多个数据库,则mysql命令行工具具有-o标志,只能导入一个数据库.

If you're worried the dump contains multiple databases, the mysql command line tool has a -o flag to only import the one.

这篇关于如何在重命名某些表/列而根本不导入其他表/列的同时导入mysql dump?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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