2

Is it possible to set up a user in MySQL 5.5 with a new password whilst keeping existing users with the old type of passwords? By old and new passwords I mean the style of hash.

I was thinking I could try specify the hash directly but I'm struggling to get that working (I'm new MySQL).

Unfortunately I can't update all users to the new type of passwords as it would break access to a system I can't control. I also need the default new account to use the old style hash.

3

It is possible before version 5.7, where it has been disabled.

To set up an old password for a user, use command:

SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('mypass');

More information: Password Hashing in MySQL.

You can enable/disable old passwords globally or per session. On a server where they are enabled globally (i.e. the server was started with old_passwords = 1), run this:

SET @@session.old_passwords = 0;
SET PASSWORD FOR 'test'@'localhost' = PASSWORD('mypass');

to disable them for a session. The PASSWORD in the above snippet will return a password in the new format, affecting only the current session.

-1

First you should stop or disable all the services if any other database is active on your system, then you can do it with an active instance of MySQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.