Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Delete entire database

I would like to delete a complete database created by my application.

Do you know any adb command, or android sentence to do it?

like image 914
Sosi Avatar asked Jan 29 '10 10:01

Sosi


People also ask

How do I destroy a SQLite database?

SQLite is an embedded database engine, so in order to drop a database you have to delete the file from the machine. This action will make the database no longer accessible.

How do I delete all in SQLite?

The TRUNCATE TABLE statement is used to remove all records from a table. SQLite does not have an explicit TRUNCATE TABLE command like other databases. Instead, it has added a TRUNCATE optimizer to the DELETE statement. To truncate a table in SQLite, you just need to execute a DELETE statement without a WHERE clause.

How delete all data from SQLite table in Android?

sqlite> DELETE FROM table_name; Following is the basic syntax of DROP TABLE. sqlite> DROP TABLE table_name; If you are using DELETE TABLE command to delete all the records, it is recommended to use VACUUM command to clear unused space.


2 Answers

You can run the command:

adb -s emulator-5554 shell (or whatever port you use)
cd /data/data/<packagename>/databases/

By typing ls, you will see the databases created and you can remove the one you want with rm

rm myapp.db

See more here

like image 198
ccheneson Avatar answered Oct 20 '22 01:10

ccheneson


I think you need to start up your emulator with the command: -wipe-data

like image 25
MattyW Avatar answered Oct 19 '22 23:10

MattyW