在同一实例上复制一个MySQL数据库而无需转储
直接管道数据
MySQL手动概述了一种允许将mysqldump直接输出到MySQL client的输出的方法: mySQL new_db_name此命令创建了带有名称new_db_name的DB_NAME数据库的副本。它包括数据和数据库对象(例如例程和触发器)。
使用Myisam存储引擎复制Myisam文件,使用Myisam存储引擎,直接复制数据文件是技术上的,因此是可能的,但不推荐。 The files may need to be renamed and the database may require a manual repair afterward.
Using Connection Detailsmysqldump --routines --triggers db_name | mysql new_db_name
mysqldump -u username --password=password original_db | mysql -u username -p new_db
This command copies the original_db database to a new database called new_db, using the specified credentials.
Creating a New DatabaseIf the new database does not exist yet, it must be created before using the piping method.这可以使用以下命令来完成: echo“创建数据库new_db_name” | mySQL -U用户名-P 通过遵循这些方法,您可以在同一实例上有效地创建MySQL数据库的副本,而无需中间转储文件。
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3