View Single Post
  #2 (permalink)  
Old 03-29-2008, 01:36 AM
kumaresan kumaresan is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 12
kumaresan is on a distinguished road
Send a message via AIM to kumaresan Send a message via Yahoo to kumaresan
Default Re: Change user/pwd for a database

hi,

The following command will help you to change the password.

Code:
SET PASSWORD FOR username =PASSWORD('password');
The SET PASSWORD statement assigns a password to an existing MySQL user account.

With no FOR clause, this statement sets the password for the current user.

With a FOR clause, this statement sets the password for a specific account on the current server host. Only clients that have the UPDATE privilege for the mysql database can do this.

The user value should be given in user_name@host_name format, where user_name and host_name are exactly as they are listed in the User and Host columns of the mysql.user table entry. For example, if you had an entry with User and Host column values of 'bob' and '%.loc.gov', you would write the statement like this:
Code:
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');

That is equivalent to the following statements:

UPDATE mysql.user SET Password=PASSWORD('newpass')
  WHERE User='bob' AND Host='%.loc.gov';
FLUSH PRIVILEGES;
__________________
Thanks,
v.kumarasan@gmail.com
Reply With Quote