Change password via vb.net

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
besoft
Posts: 3
Joined: Fri 16 Sep 2005 08:37

Change password via vb.net

Post by besoft » Fri 16 Sep 2005 08:42

Hi

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



Thank you

Serious

Post by Serious » Fri 16 Sep 2005 13:50

Use SET PASSWORD statement:

Code: Select all

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

besoft
Posts: 3
Joined: Fri 16 Sep 2005 08:37

Post by besoft » Sat 17 Sep 2005 07:07

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...

Serious

Post by Serious » Mon 19 Sep 2005 06:48

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()

besoft
Posts: 3
Joined: Fri 16 Sep 2005 08:37

Post by besoft » Mon 19 Sep 2005 07:17

Thank you for help !

You are the best..

Post Reply