Skip to main content



This handler allows you to generate GraphQL schema using graphql-compose-mysql based on a MySQL database schema or an SQL dump file.

To get started, install the handler library from NPM:

$ yarn add @graphql-mesh/mysql

Now, you can use it directly in your Mesh config file:

- name: Employees
host: localhost
port: 3306
user: root
password: passwd
database: employees

How does where work?#

Every CRUD operation has where field in their input so you can see all the columns of a table. where works like below;

getProduct(where: {
id: 5,
year: '>2010',
price: '100..200',
level: '<=3',
sn: '\*str?',
label: 'str',
code: '(1,2,4,10,11)'
}) {

This GraphQL operation will send the following query to your MySQL database;

SELECT id, name FROM product WHERE id = 5 AND year > '2010' AND (price BETWEEN '100' AND '200') AND level <= '3' AND sn LIKE '%str\_' AND label = 'str' AND code IN (1,2,4,10,11)

Config API Reference#

  • host (type: String)
  • port (type: Int)
  • user (type: String)
  • password (type: String)
  • database (type: String)
  • pool (type: Any) - Use existing Pool instance Format: modulePath#exportName