Skip to main content
Version: 3.x

MySQL

Preview Feature
MySQL support is in preview and may be subject to breaking changes in future releases.

Installing driver​

npm install mysql2

Creating ZenStackClient​

import { schema } from './zenstack/schema';
import { createPool } from 'mysql2';
import { ZenStackClient } from '@zenstackhq/orm';
import { MysqlDialect } from '@zenstackhq/orm/dialects/mysql';

const db = new ZenStackClient(schema, {
dialect: new MysqlDialect({
pool: createPool(process.env.DATABASE_URL),
}),
});
Comments
Feel free to ask questions, give feedback, or report issues.

Don't Spam


You can edit/delete your comments by going directly to the discussion, clicking on the 'comments' link below