通过脚本执行sql语句

user_list

abc 100

def 200

#!/bin/bash


db_name="game_s1"

db_user="db_user_s1"
db_password="123456"
db_host="127.0.0.1"

title="000"
body="1111"

while read account_id gold
do 
	echo $account_id " -- " $gold
	id=$account_id"_s1"
	attachment="10001,"$gold
#sql="insert into t_gift_mail_temp(platform_gamesvr_id, sender_name, mail_type, title, body, attachment) values('$id', 'System', 2, '$title', '$body', '$attachment');"
#echo $sql
	mysql -u$db_user -p$db_password -h$db_host  $db_name -e "insert into t_gift_mail_temp(platform_gamesvr_id, sender_name, mail_type, title, body, attachment) values('$id', 'System', 2, '$title', '$body', '$attachment');"
done < user_list




posted @ 2015-10-16 11:42  SandKing  阅读(4)  评论(0)    收藏  举报  来源