question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mySQL8: Unknown authentication plugin `sha256_password'

See original GitHub issue

Bug description

Trying to pull the schema (and I assume later querying) yields this with a vanilla mysql8 install:

Introspecting based on datasource defined in prisma/schema.prisma …
Error: Error in connector: Error querying the database: Error querying the database: Error querying the database: Unknown authentication plugin `sha256_password'.

It’s the same issue that plagues the mysql vs mysql2 npm package, ever since mysql’s default changed, downgrading auth is not a solution.

How to reproduce

  1. run npx prisma db pull on a mysql8 install

Expected behavior

No response

Prisma information

All default as per prisma.io docs. Examples included, but actual connection details censored.

DATABASE_URL="mysql://root:randompassword@localhost:3306/mydb"
datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

Environment & setup

  • OS: Debian 10
  • Database: mysql Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL)
  • Node.js version: v16.10.0

Prisma Version

prisma                  : 3.1.1
@prisma/client          : Not found
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : c22652b7e418506fab23052d569b85d3aec4883f
Studio                  : 0.423.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ikeyancommented, Sep 14, 2022

I also faced this issue. I solved the issue by correcting a wrong DB user name in the config.

1reaction
pantharshit00commented, Sep 28, 2021

No, worries. Do let me know if this somehow happens again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

6.4.1.2 Caching SHA-2 Pluggable Authentication
To set up an account that uses the caching_sha2_password plugin for SHA-256 password hashing, use the following statement, where password is the desired...
Read more >
mysql: [ERROR] unknown variable 'default-authentication ...
Step1 : Instance must be enabled with the old plugin only using which the user is created. In your case the default plugin...
Read more >
MySQL 8: ''sha256_password' is deprecated | LiteCart Forums
Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in ...
Read more >
mysql - The server requested authentication method unknown ...
My knowledge in MySQL is very simple. I installed MySQL 8.20 and as here to say, the Authentication Plugin ...
Read more >
error mysqli connect The server requested authentication ...
[mysqld] # The default authentication plugin to be used when connecting ... The server requested authentication method unknown to the client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found