Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change user password in stored procedure

Status
Not open for further replies.

superking

Programmer
Feb 21, 2006
1
DE
Hi there,

I want to give my database users the ability to change their passwords. I have set up the access to be allowed from localhost and any host (%) so I tried to set up a SP like this:

CREATE PROCEDURE `mydb`.`ChangePwd` (IN p VARCHAR(45))
BEGIN
SET PASSWORD FOR 'userx'@'localhost' = PASSWORD(p);
SET PASSWORD FOR 'userx'@'%' = PASSWORD(p);
END

But MySql always gives my an error 1064 saying that theres an error witn my syntax near (p). Any ideas?

I now that "set password for..." works for users that want to change their password for localhost access, but not for the entry 'username'@'%' so I want to use an SP that runs with root privileges.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top