# Using Plex SQLite on FreeBSD

**URL:** <https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450>\
**Category:** Plex Media Server\
**Tags:** server-truenas\
**Created:** [August 21, 2022, 10:31pm UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450 "2022-08-21T22:31:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nx6](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nx6/32/103992_2.png) [@nx6](https://forums.plex.tv/u/nx6)\
**Post date:** [August 21, 2022, 10:31pm UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/1 "2022-08-21T22:31:20Z")

</div>

So, I’ve been seeing a lot of posts about issues with the database on recent Plex Media Server releases (stuff not working after an update, and corruption in the database being pointed to as the cause). Why all these databases worked fine in previous versions and are suddenly not good with the newest releases is another topic.

What I’m really here asking for is guidance on using the Plex SQLite tool. See, I figure it would be best to check my existing database and fix it if it needs it before I do any upgrading. I’m on 1.25.9.5721 right now.

I can access the jail I have Plex in on SSH, I’ve copied the database to make a backup, and I’ve located the “Plex SQLite” tool in the files. The issue is how to actually run it. The [support document](https://support.plex.tv/articles/repair-a-corrupted-database/) just says to do:

`"Plex SQLite" [path to database]`

That’s not working for me. I just get a “command not found” error.  
And the directions after that all are from within the sqlite tool itself, so if you didn’t get there you’re stuck.

---

<div class="post-metadata">

**Author:** ![FordGuy61](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@FordGuy61](https://forums.plex.tv/u/FordGuy61)\
**Post date:** [August 22, 2022, 12:03am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/2 "2022-08-22T00:03:04Z")

</div>

You do need the path to Plex SQLite, which, for truenas, is not mentioned in the support document.

However, Plex SQLite is in the same directory as the Plex Media Server executable.

Also, the path to the PMS executable is listed at the top of the `Plex Media Server.log` file (at least on Windows & Linux).

I looked at a set of logs from the server-truenas section.

It references `/usr/local/share/plexmediaserver-plexpass/Plex_Media_Server`.

So, you might check that location and see if it has the Plex SQLite executable.

---

<div class="post-metadata">

**Author:** ![nx6](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nx6/32/103992_2.png) [@nx6](https://forums.plex.tv/u/nx6)\
**Post date:** [August 22, 2022, 12:21am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/3 "2022-08-22T00:21:15Z")

</div>

Trying again over here… I was in a directory last night that had a file named “Plex SQLite” in it. But not 100% sure it was this one.

---

<div class="post-metadata">

**Author:** ![nx6](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nx6/32/103992_2.png) [@nx6](https://forums.plex.tv/u/nx6)\
**Post date:** [August 22, 2022, 12:32am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/4 "2022-08-22T00:32:30Z")

</div>

```auto
root@plex-4:/usr/local/share/plexmediaserver-plexpass # ls
CrashUploader Plex Media Scanner Plex Transcoder
lib Plex Media Server Plex Tuner Service
Plex Commercial Skipper Plex Relay Plex_Media_Server
Plex DLNA Server Plex Script Host Resources
Plex Media Fingerprinter Plex SQLite start.sh

```

```auto
root@plex-4:/usr/local/share/plexmediaserver-plexpass # cd Plex_Media_Server
Plex_Media_Server: Not a directory.

```

So it’s not inside there.  
But the “Plex SQLite” seems to be right here in plexmediaserver-plexpass…

```auto
root@plex-4:/usr/local/share/plexmediaserver-plexpass # "Plex SQLite" "/usr/local/plexdata-plexpass/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
Plex SQLite: Command not found.

```

Edit: “Plex\_Media\_Server” looks like it’s a symlink elsewhere:

[![](https://i.imgur.com/LW6SVkP.png) ](https://i.imgur.com/LW6SVkP.png)

---

<div class="post-metadata">

**Author:** ![pl\_5309](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pl\_5309](https://forums.plex.tv/u/pl_5309)\
**Post date:** [August 22, 2022, 12:51am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/5 "2022-08-22T00:51:30Z")

</div>

Here is a script you can use as a guide [plex-fix-db.sh · GitHub](https://gist.github.com/scrathe/289b92681cb2b51daa1631013d19d4c1)

From a youtuber spaceinvaderone

Note: missing semi-colon on the “PRAGMA integrity\_check”

---

<div class="post-metadata">

**Author:** ![nx6](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nx6/32/103992_2.png) [@nx6](https://forums.plex.tv/u/nx6)\
**Post date:** [August 22, 2022, 1:08am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/6 "2022-08-22T01:08:39Z")

</div>

That script seems to be for Docker.

---

<div class="post-metadata">

**Author:** ![FordGuy61](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@FordGuy61](https://forums.plex.tv/u/FordGuy61)\
**Post date:** [August 22, 2022, 1:39am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/7 "2022-08-22T01:39:51Z")

</div>

> [@nx6](#):
>
> `"Plex SQLite"`

Try `"./Plex SQLite"`

On Ubuntu:

```auto
l0newo1f@osage:/usr/lib/plexmediaserver$ "Plex SQLite"
Plex SQLite: command not found
l0newo1f@osage:/usr/lib/plexmediaserver$ "./Plex SQLite"
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .quit
l0newo1f@osage:/usr/lib/plexmediaserver$

```

---

<div class="post-metadata">

**Author:** ![nx6](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/nx6/32/103992_2.png) [@nx6](https://forums.plex.tv/u/nx6)\
**Post date:** [August 22, 2022, 1:55am UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/8 "2022-08-22T01:55:45Z")

</div>

Yes. Looks like that was the key. Thanks!

```auto
root@plex-4:/ # cd /usr/local/share/plexmediaserver-plexpass/
root@plex-4:/usr/local/share/plexmediaserver-plexpass # service plexmediaserver_plexpass stop
Stopping plexmediaserver_plexpass.
Waiting for PIDS: 85681, 85681.
Cleaning up leftover child processes.
Waiting for PIDS: 85682, 85682.
root@plex-4:/usr/local/share/plexmediaserver-plexpass # "./Plex SQLite" "/usr/local/plexdata-plexpass/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
sqlite> PRAGMA integrity_check;
ok
sqlite>

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [November 20, 2022, 3:35pm UTC](https://forums.plex.tv/t/using-plex-sqlite-on-freebsd/805450/11 "2022-11-20T15:35:54Z")

</div>

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