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?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi, The following command will help you to change the password. Code: SET PASSWORD FOR username =PASSWORD('password'); 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; |
| |||
| 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 |
| |||
| 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.. |
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |