Skip to content
Menu
Popeens Virtual Home
  • Home
  • Booksonic
  • Guides & Tutorials
  • Powershell
  • Donations
Popeens Virtual Home

Deleting domains from your pihole history database

Posted on April 20, 2019April 20, 2019 by Patrik "Popeen" Johansson

For a while I have had an error in my home automation system that caused my hub to do hundreds of request to popeen.com every night. Today I finally sat down and fixed it and once it was fixed I also wanted to purge all the lines from the database so it doesn’t screw up my statistics anymore. Doing so was fairly simple but took me a few minutes to figure out so I decided to write it down here. That way I can come back here whenever I need to do it again and hopefully help someone else out at the same time.

First you SSH into the server running pihole, I am assuming you know how to do that already and if not there are plenty of guides for it if you google it so I won’t cover it here.

The first thing we need to do is shutdown pihole so we are free to modify the database, to shut down pihole run the command

sudo service pihole-FTL stop

Then we need to access the database, we do so by running the command

sudo sqlite3 /etc/pihole/pihole-FTL.db

ok, now it’s time to delete the domain, we do this by running this command, replace popeen.com with the domain you want to purge.

delete from queries where domain = "popeen.com";

when you have purged all the domains you want we exit the database by hitting CTRL + C

and lastly we start pihole up again by running

sudo service pihole-FTL start

2 thoughts on “Deleting domains from your pihole history database”

  1. Ulysses says:
    July 20, 2022 at 12:32 am

    This looked promising, but the 3rd step now results in this:

    sqlite> delete from queries where domain = “example.com”;
    Error: cannot modify queries because it is a view

    Reply
  2. Ulysses says:
    July 20, 2022 at 12:38 am

    Ah, it works if you use this command:

    sqlite> delete from query_storage where domain in (select id from domain_by_id where domain like ‘example.com’);

    Got this from https://gist.github.com/dentex/1ff0994e0430bdfa7326d29d09429ddc

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About

Patrik Johansson
Senior System Administrator

Working with a wide flora of systems but with a focus on Configuration Manager (MEMCM/SCCM).

This blog is mainly for “home IT” and selfhosting, you can find my more Sysadmin related posts over at my other blog Scriptingnerd.com

Passionate about Powershell and building tools that are easy to use for everyone.
In my spare time I work on other coding projects as well, mainly Booksonic

LinkedIn GitHub

My Hobby Projects

Booksonic Stream audiobooks to your phone.
 
Luncha i Mjärdevi See what is served for lunch at Mjardevi Science Park today
 
ScriptingNerd My blog for everything windows sysadmin

Recent Posts

  • How I fixed a bootloop when flashing magisk after upgrading Lineage OS
  • How I upgraded the Lenovo 4 10 Plus to Android 11 and passed SafetyNet
  • Installing Booksonic Air in the cloud for cheap
  • Migrating users and settings from Bookonic Legacy Server to Booksonic Air
  • How to install Booksonic Air on Windows 10

Affiliates

These are affiliate links, if you click on them and buy something I may earn a small amount of money without any additional cost to you. Any links found here are for products I am using myself and can stand by.
 

InterServer
Very cheap SSD/HDD based virtual servers (VPS). Starting at $6/month for 1TB. Use coupon code BOOKSONIC and get the first month for just 1 cent. I have recently started using intersever for personal projects and so far I am very happy with them.

 

Contabo
Cheap HDD/SSD/NVMe based Virtual servers (VPS)
I have used Contabo for years both for my private needs as well as to host the booksonic demo server

Twitter

Tweets by PopeenCom

Categories

  • Affiliate
  • Booksonic
  • Deals
  • Guides & Tutorials
  • My Tech
  • Powershell
  • Quick Tips
  • Slider
  • Tools

Recent Comments

  • Ulysses on Deleting domains from your pihole history database
  • Ulysses on Deleting domains from your pihole history database
  • How I upgraded the Lenovo 4 10 Plus to Android 11 and passed SafetyNet – Popeens Virtual Home on How I upgraded the Lenovo 4 10 Plus to Android Q/10 and passed SafetyNet
  • How I upgraded the Lenovo 4 10 Plus to Android 11 and passed SafetyNet – Popeens Virtual Home on How I upgraded the Lenovo 4 10 Plus to Android Pie/9 and passed SafetyNet
  • Carl Palmer on How to install Booksonic Air on Windows 10

Archives

  • December 2022
  • April 2022
  • September 2020
  • August 2020
  • March 2020
  • December 2019
  • June 2019
  • May 2019
  • April 2019
  • February 2019
  • May 2016
  • February 2016
  • January 2016
©2023 Popeens Virtual Home | Powered by WordPress & Superb Themes