Default Docker ports:
- MySQL protocol:
13306 - Postgres protocol:
15432
docker run -p 13306:3306 -p 15432:5432 apecloud/myduckserver:latestMySQL-style SQL goes to the MySQL port. DuckDB SQL goes to the Postgres port.
mysql -h127.0.0.1 -P13306 -urootpsql -h 127.0.0.1 -p 15432 -U postgresmacOS MySQL 9 CLI is not supported yet. Use mysql-client@8.4 if needed.
import mysql.connector
conn = mysql.connector.connect(host="127.0.0.1", port=13306, user="root", password="")
cur = conn.cursor()
cur.execute("SELECT 1")
print(cur.fetchall())
cur.close()
conn.close()import psycopg
with psycopg.connect("host=127.0.0.1 port=15432 user=postgres dbname=postgres") as conn:
with conn.cursor() as cur:
cur.execute("SELECT 1")
print(cur.fetchall())More Python data-tool examples: pg-python-data-tools.md.
const mysql = require("mysql");
const conn = mysql.createConnection({
host: "127.0.0.1",
port: 13306,
user: "root",
password: "",
});
conn.query("SELECT 1", (err, rows) => {
if (err) throw err;
console.log(rows);
conn.end();
});const { Client } = require("pg");
const client = new Client({
host: "127.0.0.1",
port: 15432,
user: "postgres",
});
await client.connect();
console.log((await client.query("SELECT 1")).rows);
await client.end();db, err := sql.Open("mysql", "root:@tcp(127.0.0.1:13306)/")db, err := sql.Open("postgres", "host=127.0.0.1 port=15432 user=postgres dbname=postgres sslmode=disable")Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:13306/", "root", "");Connection conn = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:15432/postgres", "postgres", "");con <- DBI::dbConnect(RMySQL::MySQL(), host = "127.0.0.1", port = 13306, user = "root", password = "")con <- DBI::dbConnect(RPostgres::Postgres(), host = "127.0.0.1", port = 15432, user = "postgres", dbname = "postgres")Live client checks live under compatibility/ and run in GitHub Actions, not on a local Docker daemon.