{"id":18135377,"url":"https://github.com/grafana/xk6-sql-driver-mysql","last_synced_at":"2025-10-27T21:32:14.025Z","repository":{"id":258639494,"uuid":"874293126","full_name":"grafana/xk6-sql-driver-mysql","owner":"grafana","description":"xk6-sql driver extension for MySQL database support","archived":false,"fork":false,"pushed_at":"2024-11-05T14:46:26.000Z","size":45,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-14T22:35:10.214Z","etag":null,"topics":["xk6","xk6-sql-driver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-17T15:13:42.000Z","updated_at":"2024-11-05T14:40:35.000Z","dependencies_parsed_at":"2024-10-24T18:07:05.979Z","dependency_job_id":null,"html_url":"https://github.com/grafana/xk6-sql-driver-mysql","commit_stats":null,"previous_names":["grafana/xk6-sql-driver-mysql"],"tags_count":3,"template":false,"template_full_name":"grafana/xk6-sql-driver-ramsql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-sql-driver-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-sql-driver-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-sql-driver-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-sql-driver-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafana","download_url":"https://codeload.github.com/grafana/xk6-sql-driver-mysql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230530648,"owners_count":18240497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["xk6","xk6-sql-driver"],"created_at":"2024-11-01T14:07:00.922Z","updated_at":"2025-10-27T21:32:14.020Z","avatar_url":"https://github.com/grafana.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xk6-sql-driver-mysql\n\nDatabase driver extension for [xk6-sql](https://github.com/grafana/xk6-sql) k6 extension to support MySQL database.\n\n## Example\n\n```JavaScript file=examples/example.js\nimport sql from \"k6/x/sql\";\nimport driver from \"k6/x/sql/driver/mysql\";\n\n// The second argument is a MySQL connection string, e.g.\n// myuser:mypass@tcp(127.0.0.1:3306)/mydb\nconst db = sql.open(driver, \"\");\n\nexport function setup() {\n  db.exec(`\n    CREATE TABLE IF NOT EXISTS roster\n      (\n        id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,\n        given_name VARCHAR(50) NOT NULL,\n        family_name VARCHAR(50) NULL\n      );\n  `);\n}\n\nexport function teardown() {\n  db.close();\n}\n\nexport default function () {\n  let result = db.exec(`\n    INSERT INTO roster\n      (given_name, family_name)\n    VALUES\n      ('Peter', 'Pan'),\n      ('Wendy', 'Darling'),\n      ('Tinker', 'Bell'),\n      ('James', 'Hook');\n  `);\n  console.log(`${result.rowsAffected()} rows inserted`);\n\n  let rows = db.query(\"SELECT * FROM roster WHERE given_name = ?;\", \"Peter\");\n  for (const row of rows) {\n    // Convert array of ASCII integers into strings. See https://github.com/grafana/xk6-sql/issues/12\n    console.log(`${String.fromCharCode(...row.family_name)}, ${String.fromCharCode(...row.given_name)}`);\n  }\n}\n```\n\n## Usage\n\nCheck the [xk6-sql documentation](https://github.com/grafana/xk6-sql) on how to use this database driver.\n\n\n### TLS Support\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e TLS support has been adopted more or less unchanged from xk6-sql v0.4.1.\n\u003e Refactoring is required.\n\nTo enable TLS support, call `loadTLS` from the script, before calling `open`. [examples/example-tls.js](examples/example-tls.js) is an example.\n\n`loadTLS` accepts the following options:\n\n```javascript\nloadTLS({\n  enableTLS: true,\n  insecureSkipTLSverify: true,\n  minVersion: TLS_1_2,\n  // Possible values: TLS_1_0, TLS_1_1, TLS_1_2, TLS_1_3\n  caCertFile: '/filepath/to/ca.pem',\n  clientCertFile: '/filepath/to/client-cert.pem',\n  clientKeyFile: '/filepath/to/client-key.pem',\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fxk6-sql-driver-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafana%2Fxk6-sql-driver-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fxk6-sql-driver-mysql/lists"}