How to delete indexedDB?

Google ChromeIndexeddb

Google Chrome Problem Overview


I'm working in a project which involves using IndexedDB. As I'm begining to know this technology, I need to be able to delete an indexedDB by hand so I can start over.

I found the way to do it in Firefox, but I can't find the way for Google Chrome.

I tried deleting the content of this folder (I'm using Mac):

{home}/Library/Application Support/Google/Chrome/Default/IndexedDB

but it seems Chrome stil have the DB anywhere so I can't start over.

Google Chrome Solutions


Solution 1 - Google Chrome

I've had success running the following in Chrome:

indexedDB.deleteDatabase('DB NAME')

Solution 2 - Google Chrome

In theory, all you need to do to delete an IndexedDB in Chrome is:

  1. In Chrome, go to Options > Under the Hood > Content Settings > All cookies and Site Data > find the domain where you created the IndexedDB
  2. Hit either the "X" or click "Indexed Database" > Remove

In Windows, the file is located here:

%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\IndexedDB

On Mac, do the following:

  1. In Chrome, go to "Settings" (or "Preferences" under the Chrome menu)
  2. Click "show advanced settings" (at the bottom of the page)
  3. Go to "Privacy" > "Content Settings" > "All cookies and Site Data" > find the domain where you created the IndexedDB
  4. Hit either the "X" or click "Indexed Database" > Remove

On Mac, the folder is located here:

/Users/[USERNAME]/Library/Application Support/Google/Chrome/Default/IndexedDB/

On Linux, the folder is located at:

/home/[USERNAME]/.config/google-chrome/Default/IndexedDB/

Solution 3 - Google Chrome

Alternarive is to do it in the developers console, using this command:

indexedDB.deleteDatabase("databaseName")

Solution 4 - Google Chrome

In Chrome webkit you can use webkitGetDatabaseNames which returns all database names

With this code, you can delete all local indexedDB:

window.indexedDB.webkitGetDatabaseNames().onsuccess = function(sender,args)
{
    var r = sender.target.result;
    for(var i in r)
	    indexedDB.deleteDatabase(r[i]);
}; 

Solution 5 - Google Chrome

To remove all Chrome IndexedDB databases run the following in OSX terminal emulator.

rm -rf ${HOME}/Library/Application\ Support/Google/Chrome/Default/IndexedDB/*

Now restart your browser and that's it.


Because I need to purge IndexedDB databases very often, I have set up an alias in my ~./bash_profile.

alias purge-idb="rm -rf ${HOME}/Library/Application\ Support/Google/Chrome/Default/IndexedDB/*"

Solution 6 - Google Chrome

Chrome -> Inspector Window -> Application -> look at left hand menu -> Storage -> IndexedDB

You have to be on your application's page though. Also I think Safari expires IDB data after 7 days or something.

Solution 7 - Google Chrome

To delete an IndexedDB from the OS X version of Chrome:

  1. In Preferences, show Advanced Settings then click the "Content Settings" button under the "Privacy" section.

  2. In the "Content Settings" popup, click the "All Cookies and Site Data" button under the "Cookies" section.

  3. In the "Cookies and site data" popup, use the "Search Cookies" textbox to look up the domain that is the source of the IndexedDB.

  4. Click on the domain entry in the list.

  5. Click on the "indexed database" tag listed under the domain.

  6. Click on the "Remove" button in the drop down detail for the indexed database.

Solution 8 - Google Chrome

write this code segment in console

window.indexedDB.deleteDatabase(<your db name>)

Solution 9 - Google Chrome

It's not possible to delete IndexedDB database (as opposed to stores and indexes) programmatically.

As for manual workarounds, this post details the location of the database on Windows systems for Firefox and Chrome.

Update: Thanks to developer Joshua Bell, Chrome implements an off-spec (but insanely useful) deleteDatabase method on the window.indexedDB object. Here's the crbug that landed this patch. Moreover, in newer versions of IE, you can delete databases via a settings panel.

Solution 10 - Google Chrome

In Debian GNU/Linux directory > /home/[username]/.config/google-chrome/Default/IndexedDB/chrome-xxx.indexeddb.leveldb/

contains regular files (for example):

> 000003.log, CURRENT, LOCK, LOG, MANIFEST-000002

Solution 11 - Google Chrome

Chrome Developer tools now have an option to delete all databases for an app, under "Application/Clear Storage".

Solution 12 - Google Chrome

This is maybe overkill for your specific question, but I kept ending up here in my struggle to delete my idb.

My solution in the end was based on mozilla's documentation, but required that I first close the database.

For me, in Javascript, the code looked like this:

my_db_instance.close(function(e){console.log(e)});
var DBDeleteRequest = indexedDB.deleteDatabase("my_db_name");

// When i had the base open, the closure was blocked, so i left this here
DBDeleteRequest.onblocked = function(event) {
  console.log("Blocked");
};

DBDeleteRequest.onerror = function(event) {
	console.log("Error deleting database.");
  console.log(event);
};

DBDeleteRequest.onsuccess = function(event) {
  console.log("Database deleted successfully");
};

Solution 13 - Google Chrome

In order to complete @Judson's answer, based on @fullstacklife's comment; for deleting IndexedDB in chrome using javascript you should:

let currentIDB = indexedDB.open("DB_NAME", DB_VERSION_INTEGER);
    currentIDB.onblocked = function(){
        //
    };
    currentIDB.onerror = function(){
        //
    };
    currentIDB.onsuccess = function(){
        var idb = currentIDB.result;
        idb.close();
        indexedDB.deleteDatabase("DB_NAME");
    };

Solution 14 - Google Chrome

Alternatively, use your web application in a new incognito window, and close it when you're done: database deleted.

Solution 15 - Google Chrome

In chrome OSX- /Users/user/Library/Application Support/Google/Chrome/Default/IndexedDB Firefox OSX - Users/user/Library/Application Support/Firefox/Profiles/4zaemxcn.default/indexedDB

You just need to make visible the library folder. All of the files are stored in folders(which are called as domain name) and the files use hash, but you can figure out the name of database from it. You can delete data from IDB because it is a client side database and all of the data is stored locally.

Solution 16 - Google Chrome

In windows, you can manually delete the whole IndexedDB databases by locating the IndexedDB directory for the browser and deleting it

For Chrome:

C:\Users\user-name\AppData\Local\Google\Chrome\User Data\Profile 1\IndexedDB

You can delete every folder which clears up the indexedDB. You can start over now.

Solution 17 - Google Chrome

I needed to get rid of an indexedDB in Chrome. So I search for this lousy thing called "email assistant" on my computer using MasterSeeker. Found the thing in a bunch folders that were indexedDB in Chrome. It seemed too easy that I just delete those files. I looked up how, and ended up here. I went to chrome settings with my Windows 10 PC. I just gave it a shot at trying to clear the browsing data. Presto - all those files disappeared from indexedDB, including that dreaded "email assistant" crapola. Now when I look in the indexedDB folder all I see that has reappeared is https_mail.google.com_0.indexeddb.leveldb - which looks like a safe non-irritating thing.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPaquitoSoftView Question on Stackoverflow
Solution 1 - Google ChromeJudsonView Answer on Stackoverflow
Solution 2 - Google ChromeTodd MosesView Answer on Stackoverflow
Solution 3 - Google Chromeuser854301View Answer on Stackoverflow
Solution 4 - Google ChromeRevoLabView Answer on Stackoverflow
Solution 5 - Google ChromeTom HimanenView Answer on Stackoverflow
Solution 6 - Google ChromepatrickView Answer on Stackoverflow
Solution 7 - Google ChromeMark CaufmanView Answer on Stackoverflow
Solution 8 - Google ChromeisambitdView Answer on Stackoverflow
Solution 9 - Google ChromebuleyView Answer on Stackoverflow
Solution 10 - Google ChromeAlexander LubyaginView Answer on Stackoverflow
Solution 11 - Google ChromeAur SarafView Answer on Stackoverflow
Solution 12 - Google ChromePrestonView Answer on Stackoverflow
Solution 13 - Google ChromeMeirDayanView Answer on Stackoverflow
Solution 14 - Google ChromewatsoupView Answer on Stackoverflow
Solution 15 - Google ChromestefanView Answer on Stackoverflow
Solution 16 - Google ChromeNaveen santhoshView Answer on Stackoverflow
Solution 17 - Google ChromeSheila BlissView Answer on Stackoverflow