如何删除并重新填充mysql数据库? [英] How to drop and re-populate mysql databases?
问题描述
我有一个包含10个表的mysql数据库,需要删除并重新填充该数据库以运行一些性能测试.使用mysqldump,我可以转储数据. 接下来,我应该遵循哪些步骤来清除数据库并重新导入?将需要针对不同大小的数据库(即具有不同行数的表)运行此命令以计算数据库性能,因此我需要确保可以复制这些步骤.
I have a mysql database with 10 tables and need to drop and repopulate the database to run some performance tests. Using mysqldump, I can dump out the data. What steps should I follow next, to clear the database, and re-import? Will need to run this for different sizes of the database (i.e. tables with different number of rows) to calculate the db performance, so I need to make sure these steps can be replicated.
推荐答案
您可能希望查看mysqldump
上的选项,例如--add-drop-database
和--add-drop-table
.在这种情况下,我可能会选择--add-drop-database
.
You might want to look at the options on mysqldump
such as --add-drop-database
and --add-drop-table
. I'd probably go for --add-drop-database
in this case.
这篇关于如何删除并重新填充mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!