MySQL的SELECT INTO OUTFILE… 备份语句
如题:
1.MySQL的SELECT INTO OUTFILE 备份语句可否用于远程备份?
2.如果可以,备份文件路径命名规则是啥,可否举例说明,不胜感激
------解决方案--------------------
1.MySQL的SELECT INTO OUTFILE 备份语句可否用于远程备份?
你的远程备份是指什么?这个INTO OUTFILE 'file_name' 只能在MYSQL数据库所在的主机上生成文件,生成文件后你可以通过操作系统脚本把文本复制到其它服务器上去。
2.如果可以,备份文件路径命名规则是啥,可否举例说明,不胜感激
SELECT a,b,a+b INTO OUTFILE '/tmp/result.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM test_table;
------解决方案--------------------1、可以,要有相应的权限;
2、
SELECT a,b,a+b INTO OUTFILE '/tmp/result.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM test_table
------解决方案--------------------1 可以
2 select * from t3 into outfile 'd:\1234.sql';