IT Community - Software Programming, Web Development and Technical Support

Change user/pwd for a database

This is a discussion on Change user/pwd for a database within the Database Support forums, part of the Web Development category; Hi Guys, is there any possibility to change user/pwd for a database from a query?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-28-2008, 10:46 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,159
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Change user/pwd for a database

Hi Guys,
is there any possibility to change user/pwd for a database from a query?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-29-2008, 12: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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-31-2008, 01:20 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,159
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Change user/pwd for a database

Hi,
Thanks for the reply
After changing the password do i need to restart the connection or it automatically reconnect after the changes in the password?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-31-2008, 02:35 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,

After changing the password No need to restart the server and there is no need of reconnection.

The only thing is when you connect the mysql next time you must provide new updated password to login..
__________________
Thanks,
v.kumarasan@gmail.com
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-02-2008, 05:24 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,159
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Change user/pwd for a database

hi,
thanks for the reply.
can we set authentication thru script for accessing DB or the various operations in DB?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-18-2008, 01:51 AM
mysqlsupport mysqlsupport is offline
D-Web Trainee
 
Join Date: Aug 2008
Posts: 2
mysqlsupport is on a distinguished road
Default Re: Change user/pwd for a database

Yes Jeyaseelan,

You can use shell script for MySQL authentication by giving user name and password in the script.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i change my IP ? ventyra Networking & Internet Connectivity 1 12-17-2007 11:22 AM
Difference between Regular database connection and Persistent Database Connections? Falcon PHP Programming 1 11-03-2007 04:13 AM
How can I convert a Access database to a MySQL database? itbarota PHP Programming 2 09-13-2007 09:04 AM
changes never change amansundar The Lounge 3 09-10-2007 08:41 AM
change a password for an existing user via mysqladmin sivakumar Database Support 1 07-20-2007 01:55 AM


All times are GMT -7. The time now is 09:53 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0