Reputation: 157
I'm trying to query remote database with the following script.
some_db="somedb"
isAnythingToProcess=$(mysql -uroot -proot -D$some_db -e "$checkSearch");
This works for me locally however whenever i try to run bash script to remote AWS server I get error
ERROR 1049 (42000): Unknown database 'somedb'
Any hints?
P.S. The database exists for sure. I can connect to it via MySQL client.
Upvotes: 3
Views: 3746
Reputation: 4284
You need to add the parameter for remote host -h
some_db="somedb"
isAnythingToProcess=$(mysql -uroot -proot -h REMOTE_IP -D$some_db -e "$checkSearch");
Upvotes: 3