[program-l] mysql and bash sell scripts

  • From: Andy Borka <sonfire11@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Fri, 26 Oct 2018 10:03:31 -0400

Hi,


Someone asked me to create a test bash script that will perform sql queries against a mysql database and return the results to a bash terminal. I can't figure out how to provide usernames and passwords in the first line.


## the following line works, but provides a login error.

#!/usr/bin/env mysql

...


# The following never works because env can't find the executable.

#!/usr/bin/env mysql -u username -pPassword


# The above returns bash: mysql -u username -pPassword not found.


Any ideas on how I can get this to work?


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: