mysql 使用 informatin_schema tables 创建 shell commands
SELECT CONCAT("mysqldump -uroot -p ", TABLE_SCHEMA, " ", TABLE_NAME, " >> ", TABLE_SCHEMA, ".bak.sql")
FROM INFORMATION_SCHEMA WHERE TABLE_NAME LIKE 'Country%';
还可以把生成的shell命令保存在文件里(但必须是本地文件夹,或者客户端所在的主机文件夹, 也或者 mapped 的server文件夹,并且文件不存在)
SELECT CONCAT("mysqldump -uroot -p ", TABLE_SCHEMA, " ", TABLE_NAME, " >> ", TABLE_SCHEMA, ".bak.sql")
FROM INFORMATION_SCHEMA WHERE TABLE_NAME LIKE 'Country%'
INTO OUTFILE 'C:/sample.sh';
concat() 方法是字符串连接方法, 若含有Null, 则结果为Null ,具体参见
http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_concat