2

How can I authenticate a valid user already registered on mysql automatically ? (Can be a batchscript, or vbs or anything that run automatically from windows) and if the user exist and the password is correct, call another batch ?

Ajay Kadyan
  • 1,081
  • 2
  • 13
  • 36
massaki
  • 759
  • 2
  • 8
  • 15
  • It isn't clear to me what you are asking. Do you mean you want to see if a specific username/password combination is a valid mysql user? Or do you have a users table that your application is using? – Cargo23 Sep 11 '12 at 14:11
  • Assuming that you can write the query, the parsing is explained here: http://stackoverflow.com/questions/1746475/dos-windows-batch-help-in-setting-a-variable-from-command-output – Alain Collins Sep 11 '12 at 17:04

1 Answers1

1

You could login with the command line client like so

mysql -uroot -ppassword -e"exit" && SET validlogin=true || SET validlogin=false
IF %validlogin% == true (ECHO run batch here) ELSE (ECHO don't run batch)

Some dos guru could probably do better

KCD
  • 9,873
  • 5
  • 66
  • 75