简体   繁体   中英

how do i specify connection parameters on the command line to run mysql in batch mode?

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.

Get rid of space. Varies with shell.

mysql -uusername -ppassword dbname

It is likely interpreting "mypassword" as your dbname.

您是否尝试过--password=mypasswd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM