tags:

views:

14

answers:

2

I need to be able to write a script to automatically connect mysql in batch mode so that I can run some .sql files.

I tried to enter the following at the prompt:

./mysql -u root -p mypassword

but I keep getting a "Enter password: " prompt.

What am I doing incorrectly?

Thanks.

A: 

Have you tried --pasword=mypasswd?

PierrOz
I gave it a try and it says "Access denied for user ....."
hmak
At least I answered your original question. Now you must have some trouble with your users right management. Check with your sysadmin the credentials you are using have the good right either on the local machine or on a remote one, depending on your env
PierrOz
+1  A: 

Get rid of space. Varies with shell.

mysql -uusername -ppassword dbname

It is likely interpreting "mypassword" as your dbname.

MJB
using mac osx terminal, I tried it still getting "Access denied for user..."
hmak
thanks, it was the space issue, but also my password had a character that interfered with the command, so I changed my password.
hmak