1. 程式人生 > >用shell指令碼執行mysql儲存過程小記

用shell指令碼執行mysql儲存過程小記

#!/bin/bash

HOSTNAME="127.0.0.1"        #資料庫資訊
PORT="3306"
USERNAME="root"
PASSWORD="pwd"
DBNAME="dbname"

execSql="call procedureName(DATE_FORMAT(NOW(),'%Y-%m-%d'))"
echo  "Begin  execute procedure."
mysql -h${HOSTNAME}   -P${PORT}   -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${execSql}"
echo  "End execute procedure."

12/19/2014 11:55:51 AM