← Back to team overview

maria-discuss team mailing list archive

Re: Best way to fetch user’s password hash?

 

Hi, Felipe!

On Aug 10, Felipe Gasper wrote:
> Hi all,
> 
> What is the best way to fetch a user’s password hash? I’d ideally like
> something that works in both MySQL and MariaDB, as many versions as
> possible.
> 
> Thank you!

You can select from mysql.user. You can use IF() function to create a
select that returns a password no matter what column it's in.

It'd be the most universal way, I think.

There're also SHOW GRANTS and SHOW CREATE USER, but they output is
version dependent and might have weird privilege requirements to see the
password.

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


Follow ups

References