Install the complete package with local command reference and every published mode.
install dbdbUse
: stays in the database’s native language. This keeps routine work short without pretending that SQL, Redis data structures and MongoDB documents are the same model.
db [driver] [options]dbshow the selected database driver and installed drivers
db <driver>select a driver: mysql|postgresql|redis|sqlite|mongodb
-c ...connect through the selected driver
-use ...select a database through the selected driver
-llist databases or namespaces through the selected driver
-tlist tables, collections or keys through the selected driver
-s <name>show structure through the selected driver
-n <name> [rows]preview records through the selected driver
-f <name> <text>search through the selected driver
-o <name> ...export through the selected driver
-a ...add data through the selected driver
-w ...update data through the selected driver
-d ...delete data through the selected driver
-m [name]save the current connection through the selected driver
-M <name>remove a saved connection through the selected driver
-k [name]list saved connections or inspect one through the selected driver
-K <name>connect using a saved connection through the selected driver
-edisconnect the selected driver
db : <native>run the selected driver's native query or command
db dump ...create a dump through the selected driver
db load <file>load a dump or script through the selected driver
Select the driver first, then connect:
The chosen driver and an ordinary connection remain in the PHP session. -m [name] explicitly saves a connection profile to the sensitive .lil.key file; -k lists it, -K reconnects and -M removes it. Prefer limited database accounts, back up before -a/-w/-d, load or arbitrary native commands, and check that both the driver and its PHP extension are available. Examples use isolated data, not your live database.
Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.
Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.
Base and Minimum are two packages of the same current module release, not separate command versions.
Install the complete package with local command reference and every published mode.
install dbInstall the reduced package. Local reference is omitted;
install db -mInstall exactly this published version.
install db -v 1.3.4Ask upgrade to check compatibility and replace the installed block only when needed.
upgrade dbRemove the extension block while leaving the core and unrelated modules intact.
install db -uExamples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.
dbNo database driver selected
mysql MySQL / MariaDB · installed
postgresql PostgreSQL · installed
redis Redis · installed
sqlite SQLite · installed
mongodb MongoDB · installeddb sqliteDatabase driver selected: sqlitedb mariadbDatabase driver selected: mysqldb oracleUnknown database driver: oracledb sqlite -c \sandbox\db\shop.sqliteStatus connected
File sandbox/db/shop.sqlite
SQLite (version depends on the host)db sqlite -use \sandbox\db\shop.sqliteStatus connected
File sandbox/db/shop.sqlite
SQLite (version depends on the host)db sqlite -c \sandbox\db\shop.sqlite | db -tname type
orders table
products tabledb sqlite -c \sandbox\db\shop.sqlite | db -s productscid name type notnull dflt_value pk
0 id INTEGER 0 NULL 1
1 sku TEXT 1 NULL 0
2 name TEXT 1 NULL 0
3 category TEXT 1 NULL 0
4 price REAL 1 NULL 0
5 active INTEGER 1 1 0db sqlite -c \sandbox\db\shop.sqlite | db -n products 2id sku name category price active
1 SHOE-1 City shoe shoes 79.9 1
2 SHOE-2 Trail shoe shoes 109.0 1db sqlite -c \sandbox\db\shop.sqlite | db -f products "shoe"id sku name category price active
1 SHOE-1 City shoe shoes 79.9 1
2 SHOE-2 Trail shoe shoes 109.0 1db sqlite -c \sandbox\db\shop.sqlite | db -lseq name file
0 main sandbox/db/shop.sqlitedb sqlite -c \sandbox\db\shop.sqlite | db : SELECT COUNT(*) AS total FROM productstotal
4
Time (varies) msdb sqlite -c \sandbox\db\shop.sqlite | db -o products -j[
{
"id": 1,
"sku": "SHOE-1",
"name": "City shoe",
"category": "shoes",
"price": 79.9,
"active": 1
},
{
"id": 2,
"sku": "SHOE-2",
"name": "Trail shoe",
"category": "shoes",
"price": 109.0,
"active": 1
},
{
"id": 3,
"sku": "BAG-1",
"name": "Canvas bag",
"category": "bags",
"price": 44.5,
"active": 1
},
{
"id": 4,
"sku": "HAT-1",
"name": "Summer hat",
"category": "accessories",
"price": 25.0,
"active": 0
}
]db sqlite -c \sandbox\db\shop.sqlite | db -a products : {"sku":"NEW-1","name":"Sample","category":"test","price":5,"active":1}Inserted 1
ID 5db sqlite -c \sandbox\db\shop.sqlite | db -w products sku HAT-1 : {"price":24}Updated 1db sqlite -c \sandbox\db\shop.sqlite | db -d products sku HAT-1Deleted 1db sqlite -c \sandbox\db\shop.sqlite | db -m demoSaved demodb sqlite -kNo saved connectionsdb sqlite -K absentSaved connection not found: absentdb sqlite -M absentSaved connection not found: absentdb sqlite -c \sandbox\db\shop.sqlite | db -e+db sqlite -c \sandbox\db\shop.sqlite | db dump tmp/sample-db.sqlSaved sandbox/tmp/sample-db.sqldb sqlite -c \sandbox\db\shop.sqlite | db load db/sqlite.sqlSQLite error: table products already existssandbox/db/sqlite.sqlThe example uses a file or directory from the protected /sandbox/ documentation workspace.
CREATE TABLE products (
id INTEGER PRIMARY KEY,
sku TEXT UNIQUE NOT NULL,
name TEXT NOT NULL,
category TEXT NOT NULL,
price REAL NOT NULL,
active INTEGER NOT NULL DEFAULT 1
);
INSERT INTO products (sku,name,category,price,active) VALUES
('SHOE-1','City shoe','shoes',79.90,1),
('SHOE-2','Trail shoe','shoes',109.00,1),
('BAG-1','Canvas bag','bags',44.50,1);
Current stable release of