Lost your MySQL database password?
create a ‘passwordrecovery.py’ Python file with the following contents:
import win32cryptimport osencrypted_data = open("C:\\Users\\{}\\AppData\\Roaming\\MySQL\\Workbench\\workbench_user_data.dat".format(os.getlogin()), "rb").read()clear_data = win32crypt.CryptUnprotectData(encrypted_data, None, None, None, 0)print(clear_data)
Downloaded Python for Windows and install : Then run the following
pip install pypiwin32
Upgrade it if it suggests to:
C:\Users\<YourUser>\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8\python.exe -m pip install --upgrade pip
Add the following to my PATH:
C:\Users\<YourUser>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8\LocalCache\local-packages\Python38\Scripts
Run the following from the command line :python c:\python\passwordrecovery.py
It then showed me my passwords 🙂
