After connecting to MySQL database, I'm getting "Error: Got packets out of order"

Viewed 2719

Currently I am trying to set up a simple REST API using Deno and MySQL. After succesfully creating database, table and inserting some values into it, I'm failing with getting those values from the Deno side. Here is my code:

import { Client } from "https://deno.land/x/mysql/mod.ts";

const client = await new Client().connect({
   hostname: "127.0.0.1",
   username: "root",
   port: 3306,
   db: "testDatabase",
   password: "",
});

await client.execute('use Ponys');

await client.query('SELECT * FROM Students');

After execute/query I always get this messages:

INFO connecting 127.0.0.1:3306 INFO connected to 127.0.0.1 Error: Got packets out of order

I'm running the app with this command:

deno run --allow-all index.ts

My local SQL server is running all the time.

Can you help find me the answer why I cannot get the values? Thanks!

2 Answers

According to the developer, it's a bug.

https://github.com/manyuanrong/deno_mysql/issues/16

More specifically...

https://github.com/manyuanrong/deno_mysql/issues/16#issuecomment-639344637

Prepare for the current crushing reality of Deno not yet possessing a functional mysql driver. It doesn't support passwords!

But when it does man... but when it does, it will soon be a one stop shop of awesomeness.

Just imagine... Beastly NGINX as the SSL Proxy, Single file Deno as the runtime Gateway and MySQL as the relational database running spectacularly in a Digital Ocean $5.00 Droplet..

I simply cannot wait.

If you making SQL requests after a long period of time - you can get a same issue.

Fix of that possible by tune this values in mysql service config:

interactive_timeout

wait_timeout

Related