使用mysqldump 备份时 有一个参数--result-file 官方解释为
Direct output to a given file 直接输入到给定的文件。
我们在备份时
mysql -uroot -p1qazxsw2 -S /var/lib/mysql/mysql.sock test >test.sql 可以重定向到test文件下面
而--result-file 参数的意义就是代替上面的方法
打开一个终端:1
[root@mysql ~]# mysqldump -uroot -p1qazxsw2 -S /var/lib/mysql/mysql.sock test --result-file=/data01/result.sql
Warning: Using a password on the command line interface can be insecure.
完成备份后
打开一个终端2:目录下面已经有了我们备份的文件。
[root@mysql data01]# ll
total 793028
-rw-r--r-- 1 root root 802072615 Mar 28 10:31 huzhichengfull.sql
drwx------ 2 root root 16384 Feb 3 05:44 lost+found
-rw-r--r-- 1 root root 0 Mar 29 10:10 p.sql
-rw-r--r-- 1 root root 9963741 Mar 29 10:13 result.sql
我们在备份时
mysql -uroot -p1qazxsw2 -S /var/lib/mysql/mysql.sock test >test.sql 可以重定向到test文件下面
而--result-file 参数的意义就是代替上面的方法
打开一个终端:1
[root@mysql ~]# mysqldump -uroot -p1qazxsw2 -S /var/lib/mysql/mysql.sock test --result-file=/data01/result.sql
Warning: Using a password on the command line interface can be insecure.
完成备份后
打开一个终端2:目录下面已经有了我们备份的文件。
[root@mysql data01]# ll
total 793028
-rw-r--r-- 1 root root 802072615 Mar 28 10:31 huzhichengfull.sql
drwx------ 2 root root 16384 Feb 3 05:44 lost+found
-rw-r--r-- 1 root root 0 Mar 29 10:10 p.sql
-rw-r--r-- 1 root root 9963741 Mar 29 10:13 result.sql
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26764973/viewspace-1480781/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26764973/viewspace-1480781/