如何将几个.sql文件一次导入mysql数据库? [英] How to Import Several .sql files at once into a mysql Database?

查看:196
本文介绍了如何将几个.sql文件一次导入mysql数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个 .sql 个文件,我想立即导入所有这些文件到MySQL数据库中。

I have several .sql files and I want to import all of them at once into a MySQL database.

我正在使用 WAMP ,直到现在:

I'm using WAMP, and until now:

我去PHPMyAdmin,然后我访问数据库,我点击import然后选择一个文件并导入它。但是由于我有超过10个文件,我想知道是否有更好的方法来执行此操作,例如一个文件导入其他文件或类似文件。

I go to PHPMyAdmin, then I access to the database, I click "import" and I select a file and import it. But as I have more than 10 files, I would like to know if there is a better way to do it, something like one file which imports the other files or similar.

我希望解决方案在我的电脑中不安装其他程序

谢谢提前完成。

推荐答案

感谢BlackCharly,我发现如何在Windows中执行此操作,打开终端转到内容文件夹并写入:

Thanks BlackCharly, I found how to do it in Windows, open a terminal go to content folder and write:

copy /b *.sql all_files.sql

这只汇总了所有文件中的一个,使用PhpMyAdmin快速导入

This concate all files in only one, making it really quick to import with PhpMyAdmin

在Linux中,正如BlackCharly所说:

In linux, as BlackCharly says:

cat *.sql  > all_files.sql

最后但并非最不重要的是,请考虑@mosh评论:

Last but not least, please, take into account the @mosh comment:


如果all_files.sql已经存在,这可能导致文件本身的递归复制
无止境!将结果放在单独的
目录中是安全的。

If all_files.sql is already present, this can result in recursive copy of the file on itself with no end! Put the result in a separate directory to be safe.

这篇关于如何将几个.sql文件一次导入mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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