How to reset all of the connection details that have been encrypted with it in the Admin Panel

Hi, all.
I have lost my MB_ENCRYPTION_SECRET_KEY, and find a solution in documents.

Take care not to lose this key because you can’t decrypt connection details without it. If you lose (or change) the key, you’ll have to reset all of the connection details that have been encrypted with it in the Admin Panel.

So, my question is where’s the connection details and how to reset them.

Hi @anduin

Make sure you have backups before doing anything.

You would have to manually change information the application database from encrypted to clear text.
Specially everything in metabase_database.details to something like this:

{"additional-options":null,"ssl":false,"password":"MY_DB_PASS","let-user-control-scheduling":false,"port":3306,"dbname":"MY_DB_NAME","host":"MY_DB_HOST","tunnel-enabled":false,"user":"MY_DB_USER"}

And all values in the table setting.value. If you don’t know the value, then remove the row, so Metabase can create new on startup.

I would recommend setting up a new instance, so you can see and compare the information needed.

I solved the problem, thank you.:smile:

@anduin
It would be helpful to others if you wrote what you did - if you did something different than what I explained.

Here’s what I actually did

  1. backup database
  2. execute one SQL script in the application database. this sql clear the database connection details.
    UPDATE  `metabase_database` set `details` = ''
    
    After executing this script, you will lose all database connection details.
  3. execute another SQL script in the application database.attention : this script will lose all setting in admin panel. I don’t know setting key meaning, so I truncate the table.
    TRUNCATE `setting`
    
  4. login and set all setting in admin panel
  5. Click "Sync database schema now " and “Re-scan field values now” in database.
1 Like

In my case, run this would help clearing database connection details:
UPDATE metabase_database set details = '{}';