I'm trying to execute a query inside a MySQL container in the following way:
docker exec $MYSQL_CONTAINER_NAME mysql -uuser -puser -D mydb -e "SELECT a FROM b WHERE c = 'd';"
It just prints mysql: [Warning] Using a password on the command line interface can be insecure. without printing anything else. No matter if it's an UPDATE or a SELECT, it just doesn't either output anything or produce any update on the database.
What could be the reason?
CodePudding user response:
An 'update' statement doesn't print anything, so it's normal behaviour that there's no output besides the warning.
If your 'select' doesn't match any data, then it's also normal behaviour not to print anything.
Try selecting CURRENT_TIMESTAMP since that always returns a value. Like this
docker exec $MYSQL_CONTAINER_NAME mysql -uuser -puser -D mydb -e "SELECT CURRENT_TIMSTAMP;"
