There is this particular database named temp which I want to delete which was created using SQLite on ubuntu machine. How do I delete this databse?
Asked
Active
Viewed 1.6k times
1
-
4SQLite databases are just files. You can delete the database by deleting the file. Reference: http://www.sqlite.org/about.html – mechanical_meat Jan 17 '14 at 07:17
-
Where will the files be present in ubuntu? – dmn Jan 17 '14 at 07:22
-
Delete the file. Where is the file? where the programme using it place it. – bgusach Jan 17 '14 at 07:38
2 Answers
2
The case is quite simple.
Either delete the file like this :
rm -fr filename
Or in terminal type something like :
$ sqlite3 tempfile (where tempfile is the name of the file)
sqlite> SELECT * FROM sqlite_master WHERE type='table';
You will see a list of tables like this as an example:
table|friends|friends|2|CREATE TABLE friends (id int)
then just type
sqlite> drop table friends (or the name you want to drop)
Then press ctrl-d to exit.
It is that simple

Trausti Thor
- 3,722
- 31
- 41
0
SQLite saves data to a file. Leverage the methods tailored to the specific OS so you can delete the file. I.E. with Android use the System.IO.File.Delete() method.
Here is some code showing what I used to create and delete my SQLite database on an android device in C#:
public class SQLite_DB
{
private string databasePath;
public SQLiteAsyncConnection GetConnection()
{
databasePath = Path.Combine(FileSystem.AppDataDirectory, "sqlite_db.db3");
SQLiteAsyncConnection database = new SQLiteAsyncConnection(databasePath);
return database;
}
public bool DeleteDatabase()
{
File.Delete(databasePath);
if (File.Exists(databasePath))
return false;
return true;
}
}
For Ubuntu, a simple rm -rf [database path/filename] should suffice.

LeoThaGodKing
- 21
- 5
-
Note that there can remain `databasePath + "-journal"`, `databasePath + "-wal"` and/or `databasePath + "-shm"` files left over if the application crashed or the journal/WAL is permanent. – xOneca Jul 18 '22 at 13:39