• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1912
  • Last Modified:

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
0
AWestEng
Asked:
AWestEng
1 Solution
 
Aleksandar Bradarić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

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now