Brute-Force MySQL Password From a Hash - Percona Database Performance Blog
most cases, MySQL password instructions provide information on changing MySQL user passwords on the production system (e.g., reset root password without restart). It is even recommended to change passwords regularly for security reasons. But still, sometimes DBA duties on legacy systems offer surprises and you need to recover the original password for some old users.
There is no magic: as long as only hashes are stored and not the original passwords, the only way to recover the lost password is to brute force it from the known hash.
Note on Security and mysql-unsha1 Attack
Interestingly, if a hacker has access to password hash and can sniff mysql traffic, he doesn't need to recover a plain text password from it. It doesn't matter how strong the password and how strong the hashing algorithm inside the auth plugin, due to MySQL protocol design, sniffed hash is enough to connect to a database with a patched version of MySQL client. It means, if a hacker has access to a database backup and traffic, he automatically receives all needed information (SHAs) for connecting to a running database. See for the attack details.
Since MySQL 8.0, caching_sha2_password auth plugin is used by default, and this plugin brings a stronger sha256 function instead of sha1 used in mysql_native_password plugin. For authentication with caching_sha2_password plugin, it is also enough to have only a hash and be able to sniff traffic, see for the implementation details.
Still, if you want to have a password that works with an unmodified client, however, you need to do some hacking, see instructions below
Shared On DLIKE
If you work with database, I can recommend using dotconnect for sqlite.