0

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.

2 Answers 2

1

Get rid of space. Varies with shell.

mysql -uusername -ppassword dbname

It is likely interpreting "mypassword" as your dbname.

Sign up to request clarification or add additional context in comments.

2 Comments

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

Have you tried --password=mypasswd?

1 Comment

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

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.