Home > Software engineering >  Changing a user's password in a DBMS
Changing a user's password in a DBMS

Time:07-08

I have a practice test question that states "Assume there is a user named michelle. Write code to change her password to 'agent6'". That is all the information given. I'm not sure what this is referring too, my only hint is that it is a DBMS exam. Could this possibly be referring to something general?

CodePudding user response:

It could be that they want to make sure you are not storing the password in the clear. In databases, you should always use a hashing method to store the password. So your SQL would be sthg along the lines of

UPDATE users SET password=hashtext('thepassword') WHERE username='michelle'

Note that PostgreSQL as an example has better than this: extensions! See this SO post for details.

  • Related