How to add admin role to user from DB?


I have lost the password of the root account of my instance.
And the email used is not valid.

I have a regular user account on this instance though, and access to sysqtem admin rights.
I have logged directly in the postgres DB hoping to set admin rights to it by hand,
But I cannot find any columns linked to the « role » in either user / actor / account tables.
Where is this information stored please ?

Thanks in advance

I think that the easiest way to recover your access is to change the root user email in the database, then try to recover his password.

1 Like

Same question then : I don’t see any « email » column either …

(0 rows)

peertube=# select * from actor where false;
 id | type | preferredUsername | url | publicKey | privateKey | followersCount | followingCount | inboxUrl | outboxUrl | sharedInboxUrl | followersUrl | followingUrl | avatarId | serverId | createdAt | updatedAt 
(0 rows)

peertube=# select * from account where false;
 id | name | description | actorId | userId | applicationId | createdAt | updatedAt 

select * from "user" where "username" = 'root';
Should return 1 line, with an « email » field.

And check that your are in the correct database. Your prompt says «peertube», but the official documentation use «peertube_prod». Perhaps have you 2 databases and are looking the wrong one?

It’s wierd. I only have this :

peertube=# select * from user;
(1 row)

I only have a single DB « peertube ». I am running version 2.4 migrated from 1.0 beta.
Everything is running fine, but we got spammed by QAnon vids !

This is how the root password is reset-) This is in the documentation.

With postgresql, you have to add double quotes on table names:
select * from "user";

1 Like

Ah thanks a lot !
I could have searched a long time before figuring this out.