从 .sql 文件中提取数据转储

发布于 2024-10-08 13:07:49 字数 221 浏览 0 评论 0原文

我有一个 .sql 文件,它是四年前的数据库备份。这个 .sql 文件充满了表创建和数据转储。因为我实际上不需要也不想要这些数据,所以我正在寻找一种从 .sql 文件中提取所有数据转储的方法。所以我只是恢复表架构。

认为.sql 文件是由 cPanel 备份服务生成的。

有某种自动化的方法可以做到这一点吗?我无法手动完成此操作,因为 .sql 文件有大量行。

I've got an .sql file, it's an database backup from four years ago. This .sql file is filled with table creations but also data dumps. Because I actually don't need and want the data I'm looking for an way to extract all the data dumps from the .sql file. So that I'm only restoring the tables architecture.

I think the .sql file was generated by cPanel backup service.

Is there some automated way of doing this? I can't do it by hand because the .sql file has an enormous amount of lines.

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

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

发布评论

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

评论(1

断桥再见 2024-10-15 13:07:49

@Boyd:使用本地导入转储文件

mysqldump -d -h localhost -u root -p thedatabase > dumpfile.sql

然后使用仅导出结构

mysqldump -u username -p --no-data thedatabase > newdumpfile.sql

@Boyd: Import the dump file locally using

mysqldump -d -h localhost -u root -p thedatabase > dumpfile.sql

Then export just the structure using

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