[英]Passing variable in MYSQL select statement
我在這里使用bash腳本時遇到麻煩,請選擇更具體的mysql。 它在沒有變量的情況下運行良好,但是當我聲明變量時腳本失敗,請告知:
#!/bin/bash
table="user_vpn_account"
1="2" # when I introduce this variable script fails , if I will use value "2" directly script works
pwd="password"
D="database"
mysql -uroot -p$pwd -D$D -s -N -e "SELECT port FROM user_vpn_account where user_vpn_id=$1;"
/usr/bin/mysql -uroot -p$pwd -D$D<< eof
eof
第1行的錯誤1064(42000):您的SQL語法有錯誤; 檢查與您的MySQL服務器版本相對應的手冊,以在第1行的''附近使用正確的語法
提前致謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.