寻找一种从MySQL数据库查询数据并将其写入输出txt文件的方法。我正在尝试从远程窗口框中查询 Linux 服务器数据库。
MySQL 查询:
mysql -u XXX -pXXX -h ttplxapp-esm01.abc.com -D telalert -e "select max(convert_tz(start_time,"+00:00","-04:00")) AS Time,group_concat(username SEPARATOR " ") AS Contact, message AS Message from sends where convert_tz(start_time,"+00:00","-4:00") like "$query_date%" group by alert_id order by Time desc ;"
java脚本或脚本将是理想的。
尝试SELECT...FROM
语句INTO OUTFILE
子句。
选择语法。