denodrivers/mysql

"Not supported" error

halvardssm opened this issue · 11 comments

Hi! I am trying to use this module in my application, but I receive an error "Not supported" whenever I try to connect. I shouldn't have any options which would cause the issue, but am I doing something wrong? Also, if it has anything to say, I am using the docker image of mysql:latest for the db, and Deno 0.41.0

Here is my code:

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

const config: ClientConfig = {
	hostname: "localhost",
	port: 5001,
	username: "root",
	password: "pwd",
	db: "test",
	debug: true
}

const client = await new Client().connect(config);

console.log(await client.query("select 1 from nessie_migrations limit 1;"))

And here is the error:

$ deno run --allow-net --allow-read test.ts
Compile file:///Users/halvardssm/dev/mix/deno-nessie/test.ts
INFO connecting localhost:5001
error: Uncaught Error: Not supported
► auth.ts:43:13

43       throw new Error("Not supported");
               ^

    at auth (auth.ts:43:13)
    at buildAuth (auth.ts:42:24)
    at Connection._connect (connection.ts:53:18)
    at async Connection.connect (connection.ts:82:5)
    at async Client.createConnection (client.ts:45:5)
    at async DeferredStack.pop (deferred.ts:33:20)
    at async Client.useConnection (client.ts:109:24)
    at async Client.query (client.ts:89:12)
    at async test.ts:14:13

Ok, so I figured out that the reason for this is that I am using MySQL 8. What exactly needs to be done to support MySQL 8? Anything I can help you with?

#16
The default authentication plug-in for 8.0 has not yet been implemented. If you want to use it now, you need to turn off authentication and use a blank password to access

Ok, thanks! Will add that to my readme 💪

If you want to use it now, you need to turn off authentication and use a blank password to access

A better way is to use the old version which is still present, you just need to use mysql_native_password. A simple query to update:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';

If you want to use it now, you need to turn off authentication and use a blank password to access

A better way is to use the old version which is still present, you just need to use mysql_native_password. A simple query to update:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<password>';

I didn't have much luck with that approach, but changing the MySQL configuration itself worked just fine.

In the [mysqld] section of my MySQL configuration file I added

default_authentication_plugin=mysql_native_password

@manyuanrong, I think this solution might be slightly better than blank passwords, yes?

Hello, any news on supporting caching_sha2_password ? Thanks.

@manyuanrong, please ? :)

Was this fixed. i cant seem to connect to mysql 8

Hello, still no news ? Thanks

I have actually the exact same Problem with my project.

Should be fixed by #137 and #68.