How can I check the mysql connection for a user/password using batch/shell script
Posted
by machaa
on Stack Overflow
See other posts from Stack Overflow
or by machaa
Published on 2010-04-19T15:55:32Z
Indexed on
2010/04/19
16:13 UTC
Read the original article
Hit count: 306
Hi,
How can I check the mysql connection for a user/password using batch/shell script?
I've user name and password, and I need to authenticate whether they are correct or not, but how?
I tried this way:
- I've created a batch file "run.bat" with "mysql -u User--password=UserPassword < commands.sql"
- "commands.sql" file contains "\q"
- When I run the file "run.bat" the output is nothing when User/Password are correct and "ERROR 1045 (28000): Access denied for user ... " when User/Password are incorrect. Now can we capture this output, and decide whether the connection is successful or not, if yes how?
Regards
© Stack Overflow or respective owner