Install the complete package with local command reference and every published mode.
install mysqlmysqlUse :.
mysql [options] · mysql : <sql>mysqlshow the current
mysql -c <host> <user> [database] [-p <port>] [-s <socket>] [-charset <charset>] [-n] [-m [name]]connect; password is requested separately unless -n is used
-use <database>select another database
-llist databases
-tlist tables and views
-s <table>show columns and data types
-n <table> [rows]preview table rows
-f <table> <text> [rows]find text across table columns
-o <table> [-j|-csv] [file] [-f]export table rows
-a <table> : <json>insert one row from a JSON object
-w <table> <field> <value> : <json>update matching rows from a JSON object
-d <table> <field> <value>delete matching rows
-m [name]save the current connection in .lil.key; default name is the database
-M <name>remove a saved connection
-k [name]list saved connections or inspect one without showing its password
-K <name>connect using a saved connection
-edisconnect and clear connection data
mysql : <sql>execute native SQL
mysql load <file.sql>execute SQL from a file
mysql dump [file.sql] [-f]create a schema and data dump
mariadb [options]alias for @
Connect with -s products for columns, -n products 2 for sample rows, -f for a text search or -o to export JSON/CSV. SQL after dump writes schema and rows to SQL; load executes a SQL file.
Use a restricted account and inspect a SELECT before changing rows. -a inserts JSON fields, -w updates all matches and -d deletes all matches: these operations are not automatically reversible. A saved -m profile may contain a password in .lil.key. Exporting more than 100,000 rows is rejected; load rejects files over 32 MiB. PHP MySQLi and access to a
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 mysqlInstall the reduced package. Local reference is omitted;
install mysql -mInstall exactly this published version.
install mysql -v 1.1.4Ask upgrade to check compatibility and replace the installed block only when needed.
upgrade mysqlRemove the extension block while leaving the core and unrelated modules intact.
install mysql -uExamples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.
mysql -c localhost demo shopStatus connected
Server MySQL / MariaDB
Host localhost:3306
User demo
Database shop
Charset utf8mb4mysql -c localhost demo shop -nStatus connected
Server MySQL / MariaDB
Host localhost:3306
User demo
Database shop
Charset utf8mb4mysql -c localhost demo shop -p 3307 -charset utf8mb4Status connected
Server MySQL / MariaDB
Host localhost:3307
User demo
Database shop
Charset utf8mb4mysql -c localhost demo shop -s /tmp/mysql.sock -nStatus connected
Server MySQL / MariaDB
Host localhost:3306
User demo
Database shop
Charset utf8mb4mysqlStatus connected
Database shop
Charset utf8mb4mysql -use shopStatus connected
Database shopmysql -lshopmysql -tproducts BASE TABLEmysql -s productsField Type Null Key Default Extra
id bigint unsigned NO PRI NULL auto_increment
sku varchar(64) NO UNI NULL
name varchar(180) NO NULL
category varchar(80) NO NULL
price decimal(10,2) NO NULL
active tinyint(1) NO 1 mysql -n products 2id sku name category price active
1 SHOE-1 City shoe shoes 79.90 1
2 BAG-1 Canvas bag bags 44.50 1mysql -f products "shoe"id sku name category price active
1 SHOE-1 City shoe shoes 79.90 1mysql -o products -j[
{
"id": 1,
"sku": "SHOE-1",
"name": "City shoe",
"category": "shoes",
"price": "79.90",
"active": 1
},
{
"id": 2,
"sku": "BAG-1",
"name": "Canvas bag",
"category": "bags",
"price": "44.50",
"active": 1
}
]mysql -o products -csv tmp/products.csvSaved sandbox/tmp/products.csvmysql -o products -j tmp/products.json -fSaved sandbox/tmp/products.jsonmysql -a products : {"sku":"NEW-1","name":"Sample","category":"test","price":5,"active":1}Inserted 1
ID 3mysql -w products sku SHOE-1 : {"price":75}Updated 1mysql -d products sku SHOE-1Deleted 1mysql : SELECT COUNT(*) AS total FROM productstotal
2
Time (varies) msmysql dump tmp/shop.sqlSaved sandbox/tmp/shop.sql
Tables 1
Views 0mysql load db/mysql.sqlMySQL error 1050: Table 'products' already existsmysql -m demoSaved demomysql -kNo saved connectionsmysql -K missingSaved connection not found: missingmysql -M missingSaved connection not found: missingmysql -e+mariadb -tproducts BASE TABLEmysql -c localhost demo shop -p 99999Invalid database portsandbox/db/mysql.sqlThe example uses a file or directory from the protected /sandbox/ documentation workspace.
CREATE DATABASE IF NOT EXISTS shop CHARACTER SET utf8mb4;
USE shop;
CREATE TABLE products (id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, sku VARCHAR(64) UNIQUE NOT NULL, name VARCHAR(180) NOT NULL, category VARCHAR(80) NOT NULL, price DECIMAL(10,2) NOT NULL, active TINYINT(1) NOT NULL DEFAULT 1);
INSERT INTO products(sku,name,category,price,active) VALUES ('SHOE-1','City shoe','shoes',79.90,1),('BAG-1','Canvas bag','bags',44.50,1);
Current stable release of