MySQL protocol
ASQL answers on the MySQL protocol as server version 5.7.44-aios-asql. MySQL and MariaDB drivers, ORMs and GUI tools connect to it as to MySQL. Other protocols and grammars are available on request. Contact us.
It supports prepared statements, multiple statements per call, LOAD DATA LOCAL, zlib compression, information_schema, TLS when a certificate is configured, and mysql_clear_password for token logins.
Connecting
| From | Connect with |
|---|---|
| Command line | mysql -h 127.0.0.1 -P 3307 -u app -p store |
| Unix socket | mysql -S /opt/aios/run/asql.sock -u app -p store |
| Python | pymysql.connect(host="127.0.0.1", port=3307, user="app", password="...", database="store") |
| Node.js | mysql2.createPool({ host: "127.0.0.1", port: 3307, user: "app", password: "...", database: "store" }) |
| PHP | new PDO("mysql:host=127.0.0.1;port=3307;dbname=store", "app", "...") |
| Go | sql.Open("mysql", "app:...@tcp(127.0.0.1:3307)/store") |
| JDBC | jdbc:mysql://127.0.0.1:3307/store |
| GUI tools | connection type MySQL, port 3307 |
The socket exists when MYSQL_SOCKET is set in /etc/aios/asql.conf.
Logins
- No user configured: the server listens on 127.0.0.1 only, and any local client gets in, under any name, as admin. That includes other users on a shared machine, a container using host networking and a local SSH tunnel, so set a main login unless only you can reach the machine.
MYSQL_USERandMYSQL_PASS_FILEset: that login's password is required everywhere, local clients included. Other names are refused unless they are users or tokens.
TLS
Set MYSQL_TLS_CERT and MYSQL_TLS_KEY in /etc/aios/asql.conf. With MYSQL_TLS_REQUIRE=1, remote clients must use TLS; 127.0.0.1 and the Unix socket stay open without it.
