This has happened to me more times than I care to admit. In fact, that’s why I’m writing this article. Recovering a stored password from HeidiSQL is relatively easy, though not necessarily an intuitive process. So here’s how to recover a password stored in HeidiSQL in six simple steps.
- Open HeidiSQL and select File > Export Settings to dump settings into a text file.
- Open the text file and search on the host name of the database you want to recover the password for.
- A couple lines below the host name is the encoded password. It’ll look something like: 755A5A585C3D8141. Keep this handy.
- Copy the following code into a new document.
<!doctype html> <html> <body> <script> function heidiDecode(hex) { var str = ''; var shift = parseInt(hex.substr(-1)); hex = hex.substr(0, hex.length - 1); for (var i = 0; i < hex.length; i += 2) str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift); return str; } document.write(heidiDecode('[ENCODED_PASSWORD]')); </script> </body> </html>
- Copy and paste the encoded password from the HeidiSQL settings file into the heidiDecode function as the value to be passed as the hex argument, i.e. replace [ENCODED_PASSWORD] with your actual encoded password.
- Save as a HTML document and run it in a web browser.
The text that displays on the web page is the decoded password stored in HeidiSQL. Simple!
Thanks to jpatters and his GitHub Gist, which I always eventually stumble upon after spending way too much time googling for a solution. Hopefully, this expanded explanation of that gist will help someone who’s unfamiliar with exporting and reading HeidiSQL data dumps, working with JavaScript, or who needs help filling in the gaps in the gist’s directions.
Thank you, man! That made my day 🙂
For some reason, I had to recover a lost password, that was set in the past (and not documented).
Thank you! Kept me from looking like a moron to my client.
This was very helpful, Thanks a lot
Thanks 😀
Still very useful. Thanks!!
Thanks, very useful!
You are awesome! Thank you very much!!!
Thank you Man!
Thank you very much, your article was very helpful. Greetings from Colombia
Brilliant! Thank you much.
You saved me an hour of my life. You are a swell chap!
Great and slick solution…
I just forked and added browser detection to the script to be able to run it from node in command line without any browser needed.
So it will run for node as for browser inclusion
https://gist.github.com/Wolfium/75a2e6614ef11f92eb1627a1bdea5881#file-heididecode-js
That’s awesome Wolfium!
Super… It worked for me.
Thank you
Thanks a bunch! I hate passwords.
Great job! Thx
You are a Star! Thank You.
Thank you!!!!
Amazing,
Thank You
Omg, thank you so much 😀 I forgot to save it in my password manager, and otherwise I would have to reinstall everything. Thanksss!
Perfect!
Thank you
Awesome
Top thank’s
GENIUS! You saved the day… THANK YOU!!
You saved my butt. Thank you so much for this!