Skip to main content

Change password of mysql users


Change MySQL user's password in bulk



Sometimes we need to change the password of mysql users at bulk. Lets say your company has fired a group of peoples or dissolved a project. This requirement can be supplied as :


We can achieve the same by changing the password field in mysql.user table. Password() is a predifined method in mysql which generates encrypted value of a certain string.

host
update mysql.user set password = PASSWORD("passwd") where host IN (<Comma separated list of HostName/IP>);

user
update mysql.user set password = PASSWORD("passwd") where user IN (<Comma separated list of ‘user’@’host’>);










Comments

Enter your email address: