1

I have a bash file db_reset

drop database foo;
create database foo;

And I am trying to run this script:

prompt> mysql -uroot -p < db_reset

the password is requested every time

prompt> mysql -uroot -p < db_reset
Enter password:

And I want to skip this step. Password is empty. I've tried with solutions like

prompt> mysql -uroot -p"" < db_reset
Enter password:

but the result is always the same. Can someone help me?

1 Answer 1

2

If you don't want to supply a password, just omit (leave off) the -p option

:~$ mysql -u root

N.B. A blank password is not secure. If this was my database, there's no way that there would be root account, or any account, without a password or other secure authentication mechanism. (MySQL shouldn't even allow connections without authentication.)

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

1 Comment

Uh, thanks. I have been thought that with empty password, -p was still required in bash commands. thanks.

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.