The MySQL USE-statement doesn't work as expected.
I'm using the mysql -e command to concatenate USE and SELECT:
I've got a MySQL-server running with
show databases;
Result: testing
Testing contains Match.
Then I execute this bash:
MYSQL_RESULT=`mysql -h $DBIP -u testuser -ptestuser $DBSCHEMA -e "USE $DBSCHEMA; $SQL"`
with $DBSCHEMA = testing
and $SQL being a simple "select * from Match;"
**Problem: **
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Match' at line 1
It does not find Match even though it is definitely a part of testing. select * from testing.Match works (with and without USE beforehand)
Is my syntax wrong?
Server version: 5.5.43-0+deb7u1 (Debian)