#!/bin/bash
USERNAME="sysadmin"
PASSWORD="123456"
DBNAME="database"
TABLENAME="table"
select_sql="select * from table where ***;"
USERNAME="sysadmin"
PASSWORD="123456"
DBNAME="database"
TABLENAME="table"
select_sql="select * from table where ***;"
mysql -u${USERNAME} -p${PASSWORD} --default-character-set=gbk ${DBNAME} -e"${select_sql1}" > test.txt
#这样就把mysql里的数据取到了test.txt里面。