Editing JDBC (default) database using the built-in H2 Console , to restore ADMIN superuser accidently deleted

marc5 years ago

One problem remaining I can't solve myself. .It's how to restore the Traccar 'Superuser' user that has somehow dissapeared probably accidentally deleted (erratically functioning remote desktop beyond my control).

This is how I use Windows to start the built-in H2 Console which is part of default Traccar installation:

  1. Find the H2 console module in Traccar's lib folder: h2-x.x.x.jar
  2. Right click the jar file and click Open With...
  3. Choose Java(TM) Platform SE binary and OK
  4. A web browser appears. (is also a new icon in the Systray)
  5. Alter the JDBC URL jdbc:h2:C:\Program Files\Traccar\data\database
  6. click Connect (on the left should appear ATTRIBUTES CALENDARS COMMANDS etc)
  7. H2 console ready for SQL commands

I run SELECT * FROM USERS and can see a list of users fine.

Now this is where I am going wrong. The Admin 'superuser' user doesn't seem to be there. No sign of a Superuser marked as deleted I was expecting to see. So I can't see how I can mark undelete to something which isn't there.

Am I looking in the right place for this superuser? Or maybe it is really deleted and I need to create a new one? What SQL woulld I enter to do this?

Anton Tananaev5 years ago

All users are in the users table.

marc5 years ago

Sending again: SELECT * FROM USERS Nope, still the same.

I can see users in a table of users as before but one user seems to be missing. I presume the missing user in the users table is this deleted 'superuser' .

marc5 years ago

An idea. Could I create a new administrator and then (somehow) assign him with the extra admin priviledges the deleted 'superuser' had? Would that do the same thing as restore a 'superuser' back to user table?

That said, I am making the big assumption here this deleted 'superuser' lived on the user table in the first place, and not somewhere else.