Link to home
Start Free TrialLog in
Avatar of brashquido1
brashquido1

asked on

Testing MySQL credentials in a batch file

HI All,

I'm trying to write a batch file for Windows XP to install a PHP/MySQL based web app, but have come to a dead stop when trying to find a method of verifying the MySQL credentials supplied by the user. I've been using this command from the command line ;

mysql dbname --user=dbuser --password=dbpass< \s

If the credentials are all correct, then there is obviously no problem. The problem is if any one, or combination of credentials are incorrect the error returned from MySQL does not enable you to distiguish between an incorrect database name, username or password. Anyone know of anyway I can test database name, username and password seperately for MySQL in a batch file for Windows XP so I can determine exactly which credential(s) is wrong?
ASKER CERTIFIED SOLUTION
Avatar of Squeebee
Squeebee
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brashquido1
brashquido1

ASKER

Yeah, there is a difference between the error returned from an incorrect database name and incorrect username and password. I was hoping of finding someway of identifying all three credentials seperately. Doesn't sound like I'm going to have much luck though.


Incorrect database;

ERROR 1049: Unknown database 'dbname'


Incorrect username OR password;

ERROR 1045: Access denied for user: 'user@localhost' (Using password: YES)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good point...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial