0

I want to run a single MYSQL command on the CLI, i made a bash file like this:

#! /bin/bash 

mysql --user=uuu --password=ppp DATABASE "UPDATE tickets SET status = 'open' WHERE ID = $1;"

When i do something like:

gabriel$ sh open.sh 123456

I get the full command help description and the script does nothing. I tried the query directly on the DB and works. What am I missing?

2 Answers 2

3

You are missing the -e flag.

mysql --user=uuu --password=ppp DATABASE -e "UPDATE tickets SET status = 'open' WHERE ID = $1;"
Sign up to request clarification or add additional context in comments.

Comments

1

You can try:

mysql --user=uuu --password=ppp DATABASE < "UPDATE tickets SET status = 'open' WHERE ID = $1;"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.