Check if user exists iin mysql?

Hi

is there away to check if the user and password works when making a connection to a database without connection and then catch the exception

MySQL, 5 VB.Net, VS 2005
LVL 1
AWestEngAsked:
Who is Participating?
 
Aleksandar BradarićConnect With a Mentor Software DeveloperCommented:
If you can access the DB with a different user/pass then you can test any other user/pass with:
---
SELECT
  IF(COUNT(*) > 0, 'OK', 'Failed') as Status
FROM
  mysql.user
WHERE
  user = 'test_username' AND
  password = password('test_password');
---

You might have to use `old_password('test_password')` function if you are running an older version of MySQL.

Or you meant something else?
0
 
AWestEngAuthor Commented:
great man.. thx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.