Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 .sql 文件,它是四年前的数据库备份。这个 .sql 文件充满了表创建以及数据转储。因为我实际上不需要并且想要数据,所以我正在寻找一种从 .sql 文件中提取所有数据转储的方法。所以我只恢复表架构。
我认为.sql 文件是由 cPanel 备份服务生成的。
有没有一些自动化的方法来做到这一点?我不能手动完成,因为 .sql 文件有大量的行。
@Boyd:使用本地导入转储文件
mysqldump -d -h localhost -u root -p thedatabase > dumpfile.sql
然后使用仅导出结构
mysqldump -u username -p --no-data thedatabase > newdumpfile.sql