发现在网络上的答案在这里。
基本上,假设我们要运行以下查询:
Select c_id, c_first_name,c_last_name, c_address,last_modified_datefrom customerwhere last_modified_date >=@start_date and last_modified_date <= @end_date;
我们可以这样传递“ start_date”和“ end_date”:
/usr/bin/mysql –uuser_id -ppassword –h mysql-host -A -e "set @start_date=${start_date}; set @end_date=${end_date}; source ${sql_script};" > ${data_file}


