Import and export
CSV and text files: LOAD DATA
LOAD DATA LOCAL INFILE '/home/me/items.csv'
INTO TABLE items
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(sku, price, stock);
LOCALsends the file from the client. The client must allow it, for examplemysql --local-infile=1.- Without
LOCAL, the file is read on the server and must be inside the directory set inAIOS_SQL_SECURE_FILE_PRIV(an absolute path). Paths with..and symbolic links are refused. If the variable is not set, server-side files are refused. - Not available to a capability token login.
On a 500,000-row table, LOAD DATA took 0.15-0.21 s, against 1.1 s for MariaDB. A plain file (one-character separator, no quoting or escapes) loaded into an empty table is read by every core at once; anything else loads row by row.
From another database: aios sql copy
Copies a MySQL or MariaDB database, or chosen tables, from one consistent snapshot. See Copy a database into ASQL.
Backup and restore
asql-export.sh writes a consistent backup of a running server; asql-import.sh restores it. See Back up and restore.
