MySQL - 如何执行大型查询?

发布于 2024-12-20 02:36:28 字数 215 浏览 1 评论 0原文

在 Workbench 中,我将整个数据库设计导出到一系列 CREATE TABLE 语句中。由于大小查询(有超过 50 个表),我遇到了错误。我可以做些什么来让 MySQL 接受大型查询吗?

另外,我有一个大 SQL 来插入虚拟数据。我想我也会遇到同样的问题。

SQL 查询位于一个文件中。我想以编程方式打开文件,获取查询,然后执行它。我正在使用 PHP/CodeIgniter。

In Workbench, I export my entire DB design into a series of CREATE TABLE statements. I was running into errors due to the size query (there are over 50 tables). Is there something I can do to make MySQL accept large queries?

Also, I have a big SQL to insert dummy data. I assume I'll run into the same problem as well.

The SQL queries are in a file. I want to programatically open the file, grab the query, then execute it. I'm using PHP/CodeIgniter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

仅一夜美梦 2024-12-27 02:36:28

您可以使用 mysql 命令行客户端并从文件或 STDIN 读取它们来运行多个查询。这通常可以正常工作,不会出现任何问题,而且我知道很多系统都依赖于此。

请参阅4.5.1。 mysql — MySQL 命令行工具文档非交互式使用。

You can run multiple queries by using the mysql commandline client and reading them from file or STDIN. That normally works without any issues and I know a lot of systems that rely on this.

Please see 4.5.1. mysql — The MySQL Command-Line ToolDocs and non-interactive use.

眼眸 2024-12-27 02:36:28

我之前在共享主机和性能不佳的本地计算机上遇到过类似的问题。

我过去曾使用 BigDump 来错开导入。

如果有人给了您转储文件,则分解导入并不总是一个选择,以不同方式导出它也不是一个选择,因为您可能无权访问原始数据库。

I have had issues like this before on shared hosting and on poorly performing local machines.

I have used BigDump in the past to stagger the import.

Breaking up the import isn't always an option if someone has given you a dump file, exporting it differently isn't an option as you may not have access to the original DB.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文