doc/SQLite3-Server.md
ProxySQL provides a built-in SQLite3 server that acts as a MySQL-to-SQLite gateway. When started with the --sqlite3-server option, it listens on port 6030 (by default) and translates MySQL protocol queries into SQLite commands, converting the responses back to MySQL format for the client.
This is the magic of the feature: MySQL clients can use standard MySQL commands to interact with a full SQLite database, with ProxySQL handling all the protocol translation behind the scenes.
--sqlite3-server, listens on port 6030, provides access to empty main schema# Start with SQLite3 server on default port 6030
proxysql --sqlite3-server
# Connect using standard mysql client with valid MySQL credentials
mysql -h 127.0.0.1 -P 6030 -u your_mysql_user -p
Authentication uses the mysql_users table in ProxySQL's configuration.
The SQLite3 server provides:
main (initially empty)-- Check current database
SELECT database();
-- Create tables
CREATE TABLE users (id INT, name TEXT);
-- Insert data
INSERT INTO users VALUES (1, 'john');
-- Query data
SELECT * FROM users;
-- Create vector table
CREATE VECTOR TABLE vec_data (vector float[128]);
-- Insert vector
INSERT INTO vec_data(rowid, vector) VALUES (1, json('[0.1, 0.2, 0.3,...,0.128]'));
-- Search similar vectors
SELECT rowid, distance FROM vec_data
WHERE vector MATCH json('[0.1, 0.2, 0.3,...,0.128]');
-- Show available databases
SHOW DATABASES;
-- Results:
+----------+
| database |
+----------+
| main |
+----------+
mainmysql_users tableCREATE TABLE events (
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
event_type TEXT,
metrics JSON
);
INSERT INTO events (event_type, metrics)
VALUES ('login', json('{"user_id": 123, "success": true}'));
SELECT event_type,
json_extract(metrics, '$.user_id') as user_id
FROM events;
CREATE TABLE metrics (
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
cpu_usage REAL,
memory_usage REAL
);
-- Insert time series data
INSERT INTO metrics (cpu_usage, memory_usage) VALUES (45.2, 78.5);
-- Query recent data
SELECT * FROM metrics
WHERE timestamp > datetime('now', '-1 hour');
# Test connection
mysql -h 127.0.0.1 -P 6030 -u your_mysql_user -p -e "SELECT 1"
# Expected output
+---+
| 1 |
+---+
| 1 |
+---+