[mysql@master ~]$ mysqlhotcopy test /tmp
DBI connect(';host=localhost;mysql_read_default_group=mysqlhotcopy','',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at
/usr/local/mysql5.6/bin/mysqlhotcopy line 197
[mysql@master lib]$ ls /var/lib/mysql/mysql.sock
ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory
[mysql@master lib]$ ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
[mysql@master lib]$ mysqlhotcopy test /tmp
Flushed 3 tables with read lock (`test`.`students`, `test`.`t1`, `test`.`t2`) in 0 seconds.
Locked 0 views () in 0 seconds.
Copying 8 files...
Copying indices for 0 files...
Unlocked tables.
mysqlhotcopy copied 3 tables (8 files) in 0 seconds (0 seconds overall).
[mysql@master lib]$
备份的内容为:
[mysql@master tmp]$ cd test/
[mysql@master test]$ ls
db.opt students.frm students.ibd t1.frm t1.ibd t2.MYD t2.MYI t2.frm
[mysql@master test]$ ls -ltr
total 236
-rw-r--r-- 1 mysql mysql 65 Jan 14 2014 db.opt
-rw-rw---- 1 mysql mysql 8662 Mar 7 08:04 students.frm
-rw-rw---- 1 mysql mysql 98304 Mar 7 12:51 students.ibd
-rw-rw---- 1 mysql mysql 8556 Mar 7 12:55 t1.frm
-rw-rw---- 1 mysql mysql 98304 Mar 12 08:09 t1.ibd
-rw-rw---- 1 mysql mysql 8556 Mar 13 07:58 t2.frm
-rw-rw---- 1 mysql mysql 1024 Mar 13 07:58 t2.MYI
-rw-rw---- 1 mysql mysql 0 Mar 13 07:58 t2.MYD
mysqlhotcopy 只能用于MyISAM表不能用户InnoDB表