Check if user exists

Thread Solved

Join Date: Jul 2007
Posts: 169
Reputation: tuse is an unknown quantity at this point 
Solved Threads: 14
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Check if user exists

 
0
  #1
Jun 27th, 2008
I need to check if a databse user exists and if not, create that user.

However, I do not know the statement to check if a user already exits.

How to check if a user already exists in MySQL?
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 79
Reputation: varmadba is an unknown quantity at this point 
Solved Threads: 8
varmadba varmadba is offline Offline
Junior Poster in Training

Re: Check if user exists

 
1
  #2
Jun 27th, 2008
  1. SELECT user FROM mysql.user WHERE user=' ';

you should have access to mysql DB to execute the query
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 169
Reputation: tuse is an unknown quantity at this point 
Solved Threads: 14
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Re: Check if user exists

 
0
  #3
Jun 27th, 2008
Thanks a lot.

Didn't see the 'mysql' database.
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 296
Reputation: tesuji is on a distinguished road 
Solved Threads: 42
tesuji tesuji is offline Offline
Posting Whiz in Training

Re: Check if user exists

 
1
  #4
Jun 27th, 2008
Hi tuse

How are you?

Originally Posted by tuse View Post
Thanks a lot.

Didn't see the 'mysql' database.
Well, if you had access to grant table mysql.user you would have also been able to
SELECT User, Password FROM mysql.user. You got it? Yes, you would be able to hack that
mysql database. So it's a good idea that not everybody is allowed to "see" grant table.

Happy hacking !

krs,
tesu
Last edited by tesuji; Jun 27th, 2008 at 7:08 pm.
Information is moving—you know, nightly news is one way, of course, but it's also moving through the blogosphere and through the Internets. I promise you I will listen to what has been said here, even though I wasn't here. Ann and I will carry out this equivocal message to the world. I'm the master of low expectations.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 169
Reputation: tuse is an unknown quantity at this point 
Solved Threads: 14
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Re: Check if user exists

 
0
  #5
Jun 28th, 2008
Hi tesu!

I have (somehow) managed to see the mysql database!
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 6445 | Replies: 4
Thread Tools Search this Thread



Tag cloud for MySQL
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC