views:

25

answers:

1

I am trying to create a custom application that allows for adding and removing and changing passwords of users. How would I create the hash that MySQL uses to stored password in?

I know MySQL has a Password() function but I can't figure out how to use this function in NHibernate.

Anyone know how to do this?

+1  A: 

What kind of users are you talking about, mysql users or application users?

If you want to set the password of a mysql user, you don't need to use the password() function at all.

CREATE USER:

create user 'scott' identified by 'tiger';

UPDATE PASSWORD:

grant usage on *.* to 'scott' identified by 'newpassword';

If you are talking about application users, don't use the mysql password() function. Use something like sha1(), md5(), etc.

Ike Walker
I need to create users for mysql. How do you change a password? Alter user 'scott' identified by 'tiger'?
LnDCobra
Oh right, the second one JUST updates the password? doesn't give full permissions to *.*?
LnDCobra
Yes, quoting the manual: "You can also use a GRANT USAGE statement at the global level (ON *.*) to assign a password to an account without affecting the account's current privileges"http://dev.mysql.com/doc/refman/5.1/en/passwords.html
Ike Walker