How to dump SQL from SQLite3 database file
If you have a SQLite3 database file (usually the filename extension is .db
) and you want to dump it as SQL code, you can use
sqlite3 [database file] .dump
For example:
$ sqlite3 /usr/share/command-not-found/commands.db .dump
[...]
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES('packages',14669);
INSERT INTO sqlite_sequence VALUES('commands',47706);
CREATE INDEX idx_commands_command ON commands (command);
CREATE INDEX idx_packages_name ON packages (name);
COMMIT;
Missing the sqlite3
executable?
In case you don’t have the sqlite3
executable, you can install it using
sudo apt -y install sqlite3
on Ubuntu/Debian-based system