手冊我有這樣的代碼:您的SQL語法有錯誤;檢查對應於您MariaDB的服務器
ANZ=`mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT count(id) FROM $TABLE WHERE deleted=1 and not lastname='anonym';" --skip-column-names -B;`;
if [ $((ANZ)) -gt 0 ]
then
mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT id, username FROM $TABLE WHERE deleted=1 and not lastname='anonym' and username like '%@%';" --skip-column-names -B > $FILE;
cat $FILE | while read TMP
do
echo "temp:" ${TMP% *};
UserID=${TMP% *};
echo $UserID >> $RES_FILE;
echo "User $UserID wird anonymisiert...";
echo $UserID;
echo '`mysql -u$USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE $TABLE SET username="'$A$UserID'", email='[email protected]', firstname='$A', lastname='$A', icq='', skype='', yahoo='', aim='', msn='', phone1='', phone2='', institution='', dep$
echo' `mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_message SET subject='Neue Mitteilung von anonym' WHERE useridfrom=$UserID;"`';
echo' `mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_message_read SET subject='Neue Mitteilung von anonym' WHERE useridfrom=$UserID;"`';
VNAME=`mysql -N -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT firstname FROM $TABLE WHERE id=$UserID;"`;
NNAME=`mysql -N -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "SELECT lastname FROM $TABLE WHERE id=$UserID;"`;
`mysql -u $USER -p$PASSWD -h$HOST -D $DATABASE -e "UPDATE mdl_event SET name='Meeting with your Student, anonym' WHERE name LIKE 'Meeting with your Student,%$VNAME $NNAME%';"`;
done
echo
"Finish!"
而我得到的錯誤是:
的mysql -u $ USER $ -p -h PASSWD $ HOST -D $ DATABASE -e「UPDATE $ TABLE SET username =」anonym611 [email protected]「,[email protected],firstname = anonym,lastname = anonym,icq =,skype =,yahoo =, aim =,msn =,phone1 =,phone2 =,institution =,department =,address =,city =,country =,url = WHERE deleted = 1 AND id = 611 [email protected];「 ./anonym.sh:Zeile 50:echo
mysql -u $ USER -p $ PASSWD -h $ HOST -D $ DATABASE -e「UPDATE mdl_message SET subject = Neue:command not found。 ./anonym.sh :Zeile 52:echo`mysql -u $ USER -p $ PASSWD -h $ HOST -D $ DATABASE -e「UPDATE mdl_message_read SET subject = Neue:command not found。錯誤1064(42000)在第1行:您的SQL語法有錯誤;請檢查與您的MariaDB服務器版本對應的手冊,以獲取在第1行「[email protected]」附近使用的正確語法。
錯誤1064(42000)在第1行:您的SQL語法錯誤;檢查對應於您MariaDB的服務器版本在線路附近使用「[email protected]」正確的語法手冊1個
請不要使用無關的標記。 –