在同一實例上複製一個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