Page 1 of 1

Change password via vb.net

Posted: Fri 16 Sep 2005 08:42
by besoft
Hi

I need some information, how can i change password for users in table mysql.user via vb.net .



Thank you

Posted: Fri 16 Sep 2005 13:50
by Serious
Use SET PASSWORD statement:

Code: Select all

SET PASSWORD FOR 'jeffrey'@'%' = PASSWORD('biscuit');
It is undesirable to edit 'user' table directly.

Posted: Sat 17 Sep 2005 07:07
by besoft
thx for the answer.

sorry for this basic question

SET PASSWORD FOR 'jeffrey'@'%' = PASSWORD('biscuit');

if i understand this, that is the script...

i would tray this and hope that work-...

It possible do that with query ?

UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='bob' AND Host='%.loc.gov';
FLUSH PRIVILEGES

thx again...

Posted: Mon 19 Sep 2005 06:48
by Serious
As described here SET PASSWORD statement is equivalent to the UPDATE mysql.user ...;FLUSH PRIVILEGES; statements.
You can execute these queries with MySqlCommand or with MySqlScript.

Code: Select all

Dim script as MySqlScript
...
script.ScriptText = "UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='bob' AND Host='%.loc.gov';
FLUSH PRIVILEGES;"
script.Execute()

Posted: Mon 19 Sep 2005 07:17
by besoft
Thank you for help !

You are the best..