1

Possible Duplicate:
How to execute Mysql command from a shell script?

I'm trying to execute a .sql file using a bash script. But I am having a problem connecting to MySQL. Here's what I have so far:

#! /bin/sh
PWD="thepassword"
mysql -p -u theuser < Randomsqlfile.sql
echo $PWD

When the password is prompted, nothing fills out.

Community
  • 1
  • 1
Anthony
  • 79
  • 5

1 Answers1

4

Make this:

mysql -utheuser -pthepassword <Randomsqlfile.sql
ruakh
  • 175,680
  • 26
  • 273
  • 307
jkamizato
  • 196
  • 5