Remove legacy user accounts

Morning all.

I’ve just upgraded to Plex Pass to keep an eye on what my managed users are watching and in the user list showing user history, there are a load of old legacy user accounts which I deleted ages ago. They don’t appear in my user list when logging in so guess they must be sat in a table somewhere within Plex. Does anyone know how to remove them completely please?

Trivial I know, but my OCD is getting the better of me.

Thanks
Robin

You may have deleted the users, but they did watch something from your server. It happened. Why do you want to make it appear as if it didn’t?

Depending you level of expertise and how comfortable you are with editing the db directly this can be accomplished. Its fairy easy if you know what you are doing and a little tricky if your only starting but certainly doable.

The table metadata_item_views contains all the watch history which sounds like what you are concerned about. What you need to do is identify the account_id for the old legacy user you want to delete. This is most likely stored in the accounts table.

Once identified and lets pretend that account id is 54321 then running the following will list what watch history is stored for that account:

"/usr/lib/plexmediaserver/Plex Media Server" --sqlite com.plexapp.plugins.library.db
.mode column
SELECT id, account_id, grandparent_title, title from metadata_item_views WHERE account_id = 54321;

Then if you are okay to delete that you can run …
DELETE from metadata_item_views WHERE account_id = 54321;

… which will delete it. Use .quit then exit and save the db changes.

Notes:

  1. Make sure to keep backups (just in case).
  2. Make sure plex is NOT running when editing the db directly. Even better is to copy off to some temp location and copy back once you done.
  3. ENSURE YOU HAVE BACKUPS :slight_smile:

I’ve done this myself to remove a users data from my db so can confirm it works. Only difference is that it was a full plex user and not a managed account, but process should be the same.

Anyhow, you can decide if this is something you want to try yourself. If it all goes to crap, just restore your backup.

1 Like

One other way to accomplish this is a bit more tedious but also will work. You can use the Plex Dash app.

You can go to History & then Others using that app and swipe left which will give you an option to remove. It will delete that watch entry. You would need to do that for EVERY entry 1 by 1 but again, could be done that way if your not happy editing the db directly.

Perfect, thanks so much - works a treat.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.