mysql8.0 本地克隆数据
克隆插件支持以下語法在本地克隆數(shù)據(jù);即將數(shù)據(jù)從本地MySQL數(shù)據(jù)目錄克隆到MySQL服務(wù)器實例所在的服務(wù)器或節(jié)點上的另一個目錄:
clone local data directory = '' clone_dir';
要使用CLONE語法,必須安裝CLONE插件。關(guān)于安裝說明,請參見5.6.7.1章節(jié),“安裝克隆插件”。執(zhí)行CLONE LOCAL DATA DIRECTORY語句需要BACKUP_ADMIN權(quán)限。
mysql> grant backup_admin on *.* to 'clone_user';
其中clone_user是執(zhí)行克隆操作的MySQL用戶。執(zhí)行克隆操作的用戶可以是*.*上具有BACKUP_ADMIN權(quán)限的任何MySQL用戶。本地克隆數(shù)據(jù)的示例如下:
mysql> clone local data directory = '/path/to/clone_dir';
其中“/path/to/clone_dir”為數(shù)據(jù)克隆到的本地目錄的全路徑。必須是絕對路徑,且指定的目錄(“clone_dir”)不能存在,但指定的路徑必須是已存在的路徑。MySQL服務(wù)器必須具有必要的寫訪問權(quán)限才能創(chuàng)建該目錄。
mkdir /path/to/
chown mysql.mysql -R /path/to
注意:
1、本地克隆操作不支持克隆位于數(shù)據(jù)目錄之外的用戶創(chuàng)建的表或表空間。試圖克隆這樣的表或表空間會導(dǎo)致以下錯誤:error 1086 (HY000): File '/path/to/tablespace_name。文件”已經(jīng)存在。
2、克隆與源表空間路徑相同的表空間會導(dǎo)致沖突,因此是禁止的。
所有用戶創(chuàng)建的InnoDB表空間、InnoDB system表空間、redo log和undo表空間都被克隆到指定的目錄下。
If desired, you can start the MySQL server on the cloned directory after the cloning operation is complete.
$> mysqld_safe --datadir=clone_dirwhere?clone_dir?is the directory that data was cloned to.
For information about monitoring cloning operation status and progress, see?Section?5.6.7.10, “Monitoring Cloning Operations”.
總結(jié)
以上是生活随笔為你收集整理的mysql8.0 本地克隆数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Serializable接口实现深度克隆
- 下一篇: ecstore mysql_ECStor