Skip to content Skip to sidebar Skip to footer

Mysql: How To Check Exit Status?

I've a problem with mysql remote connections. One server located in USA, the other located in Netherlands and the connection between them is horrible, especially in the evenings. I

Solution 1:

same way:

echo"UPDATE table set field='1' WHERE id='${id}'" | 
       mysql --connect_timeout=10 -u${user} -p${password}${database} -h ${host}

in order to check the results, here's an example:

myhost:~ # echo "silly query;"|mysql -unoone -pwrong DBEMPTY -hlocalhost
ERROR 1045 (28000): Access denied for user 'noone'@'localhost' (using password: YES)
myhost:~ # echo $?1
myhost:~ # echo "select 0;"|mysql -uvaliduser -pproperpassword MYTESTDB -hlocalhost00
myhost:~ # echo $?0

Post a Comment for "Mysql: How To Check Exit Status?"