Ошибка client does not support authentication protocol requested by server consider upgrading mysql client

Summary

  1. If you just want to get rid of the error, at the cost of risking the security of the project (e.g. it’s just a personal project or dev environment), go with @Pras’s answer — ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password' and then flush privileges
  2. If you want to have a fix for it, without knowing why, just install and use mysql2 (instead of mysql) and use it — npm i mysql2, and mysql = require('mysql2');.
  3. If you are a curious developer who is always eager to learn, keep reading … :)

What’s going on?

Let’s first make it clear what’s going on.

MySQL 8 has supports pluggable authentication methods. By default, one of them named caching_sha2_password is used rather than our good old mysql_native_password (source). It should be obvious that using a crypto algorithm with several handshakes is more secure than plain password passing that has been there for 24 years!

Now, the problem is mysqljs in Node (the package you install with npm i mysql and use it in your Node code) doesn’t support this new default authentication method of MySQL 8, yet. The issue is in here: https://github.com/mysqljs/mysql/issues/1507 and is still open, after 3 years, as of July 2019.

UPDATE June 2019: There is a new PR in mysqljs now to fix this!

UPDATE Feb 2020: Apparently it’s scheduled to come in version 3 of mysqljs.

UPDATE July 2020: Apparently it’s still not in yet (as of April 2020 at least), but it’s claimed that node-mysql2 is supporting Authentication switch request. Please comment below if node-mysql2 is working fine for this issue — I will test it later myself.

UPDATE April 2021: It seems like the issue is still there and just 3 days ago, someone created a fork and made it there — yet not official in the mysql.js package. Also, as per the comments below, it seems like mysql2 package is working fine and supporting Authentication-switch properly.


Your Current Options

Option 1) [NOT RECOMMENDED] Downgrade «MySQL» to authenticate using good old «mysql_native_password»

That’s what everybody suggests here (e.g. top answer above). You just get into mysql and run a query saying root is fine using old mysql_native_password method for authentication:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password ...

The good thing is, life is going to be simple and you can still use good old tools like Sequel Pro without any issue. But the problem is, you are not taking advantage of a more secure (and cool, read below) stuffs available to you.

Option 2) [Meh…] Replace «Node» package with MySQL Connecter X DevAPI

MySQL X DevAPI for Node is a replacement to Node’s Mysqljs package, provided by http://dev.mysql.com official guys.

It works like a charm supporting caching_sha2_password authentication. (Just make sure you use port 33060 for X Protocol communications.)

The bad thing is, you have left our old mysql package that everyone is so used to and relies on.

The good thing is, your app is more secure now and you can take advantage of a ton of new things that our good old friends didn’t provide! Just check out the tutorial of X DevAPI and you’ll see it has a ton of new sexy features that can come in handy. You just need to pay the price of a learning curve, which expectedly comes with any technology upgrade. :)

PS. Unfortunately, this XDevAPI Package doesn’t have types definition (understandable by TypeScript) yet, so if you are on typescript, you will have problems. I tried to generate .d.ts using dts-gen and dtsmake, but no success. So keep that in mind.

Option 3) [RECOMMENDED] Replace «mysql.js» with «mysql2.js» package

As mentioned above, mysql package (NPM package link) is still having this issue (as of April 2021). But mysql2 package (NPM package link) is not. So probably the following should be the one-liner answer!

npm un mysql && npm i mysql2

Please note that mysql2 is a forked work off of the popular mysql, but its popularity (620K downloads per week for mysql2 in April 2020) has got close to the original package (720K download per week for mysql in April 2021) that making the switch seems reasonable!

What you are doing?

Mysql authentication error shows up when i run db:migrate command.

Sequelize CLI [Node: 11.11.0, CLI: 5.4.0, ORM: 4.42.0]

Loaded configuration file "src/database/config/index.js".
Using environment "development".
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators ../../node_modules/sequelize/lib/sequelize.js:242:13

ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What do you expect to happen?

it should connect to mysql database without any error. because my code can get connected with the same configuration

What is actually happening?

it gives ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Output, either JSON or SQL

Dialect: mysql
__Database version: 8.0.15
__Sequelize CLI version:5.4.0
__Sequelize version:4.42.0

Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.

Активные темы Темы без ответов

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

1 2006-08-21 12:40:36 (изменено: АCУ-32, 2006-08-21 12:47:28)

  • АCУ-32
  • Новичок
  • Неактивен
  • Зарегистрирован: 2006-08-21
  • Сообщений: 1

Тема: Ошибка #1251 — Client does not support authentication protocol

Здравствуйте уважаемые юзеры. У меня вот возник вопрос —

 
"#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client"

что это такое, что значит? Это появляется когда я ввожу имя и пароль(с файлом настроек который предложил администратор). И еще добавить хотел — я устанавливаю phpMyAdmin не на каком то хостинге а на своем компьютере в локальной сети. И вообще когда я устанавливал MySQL там нигде не просилось ввести имя. Пароль я вводил а имя и хост как мне узнать? Ну так вот я так понял что имя — «root», хост — «localhost», а пароль — тот что я вводил?
P.S. Убедительная просьба — если вы знаете причину проблемы и ее решение — напишите копию ответа мне на e-mail.

2 Ответ от Lokki 2006-08-21 20:09:04

  • Lokki
  • Lokki
  • Админ
  • Неактивен
  • Откуда: Москва
  • Зарегистрирован: 2006-01-25
  • Сообщений: 910

Re: Ошибка #1251 — Client does not support authentication protocol

АCУ-32

«#1251 — Client does not support authentication protocol requested by server; consider upgrading MySQL client»
что это такое, что значит?

Это значит, что ты запускаешь старый клиент на новом mysql-сервере.

Вот это тебе поможет: http://phpclub.ru/faq/wakka.php

З.Ы. В следующий раз запостишь где попало — удалю сообщение.

Нет неразрешимых проблем, есть неприятные решения. (Э. Борн)

3 Ответ от Rojer 2006-09-12 10:42:01 (изменено: Rojer, 2006-09-12 10:48:02)

  • Rojer
  • Новичок
  • Неактивен
  • Зарегистрирован: 2006-09-12
  • Сообщений: 1

Re: Ошибка #1251 — Client does not support authentication protocol

ребята а вы не пытальсь другими путями?
я проще сделал взял денвер оттуда взял user табличку из дб mysql перетащил уже на свой сервак и всё прекрасно работает и пароли меняются хорошо так что можно так делать smile

4 Ответ от Experior 2006-09-13 09:53:43

  • Experior
  • Участник
  • Неактивен
  • Зарегистрирован: 2006-05-24
  • Сообщений: 46

Re: Ошибка #1251 — Client does not support authentication protocol

Rojer

я проще сделал взял денвер оттуда взял user табличку из дб mysql перетащил уже на свой сервак и всё прекрасно работает и пароли меняются хорошо так что можно так делать

А версия твоего Денвера какая? wink

5 Ответ от ParSulTang 2007-07-16 06:58:59 (изменено: ParSulTang, 2007-07-16 06:59:30)

  • ParSulTang
  • Новичок
  • Неактивен
  • Зарегистрирован: 2007-07-16
  • Сообщений: 1

Re: Ошибка #1251 — Client does not support authentication protocol

Lokki сказал:

АCУ-32

«#1251 — Client does not support authentication protocol requested by server; consider upgrading MySQL client»
что это такое, что значит?

Это значит, что ты запускаешь старый клиент на новом mysql-сервере.

Вот это тебе поможет: http://phpclub.ru/faq/wakka.php

З.Ы. В следующий раз запостишь где попало — удалю сообщение.

Пардон. В этой ссылке указывается, что можно обновить все клиентские программы. А что в данном случае является клиентом? PhpMyAdmin? Если да, то почему последние версии PHPMyAdmin не поддерживают новый метод хэширования в 41 бита?

6 Ответ от Hanut 2007-07-16 13:19:35

  • Hanut
  • Hanut
  • Модератор
  • Неактивен
  • Откуда: Рига, Латвия
  • Зарегистрирован: 2006-07-02
  • Сообщений: 9,726

Re: Ошибка #1251 — Client does not support authentication protocol

ParSulTang
phpMyAdmin поддерживает все, что поддерживает PHP и MySQL. Клиентом в данном случае является библиотека расширения php_mysql.dll или php_mysqli.dll (если речь идет о Windows) подключаемые в конфигурационном файле PHP.

7 Ответ от artem 2007-11-25 21:46:38

  • artem
  • Новичок
  • Неактивен
  • Зарегистрирован: 2007-11-25
  • Сообщений: 1

Re: Ошибка #1251 — Client does not support authentication protocol

win2000
phpmyadmin 3.23.49
mysql  4.1.22
php 4.4.1

похожую проблему решил так :
нашел в каталоге mysql библиотеку libmysql.dll
скопировал ее в phpdlls (там уже была старая версия)
перезагрузил (не знаю надо ли было)
выполнил в mysql команду
SET PASSWORD FOR ‘some_user’@’some_host’ = OLD_PASSWORD(‘newpwd’);

заработало

Сообщения 7

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Recently I was working on Node.js application. In my application, I faced connection issue with MySQL server. Everything was good still I was getting following error.

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

In this article, I will show you why this error occured and how to solve this error.

While going through Googling the issue, I came to know that MySQL 8.0 is using caching_sha2_password authentication plugin rather than mysql_native_password and Node.js Mysql package uses mysql_native_password authentication plugin.

Solution:

In this situation, either you can change current user password according to mysql_native_password authentication plugin or you need to create new user with mysql_native_password authentication plugin.

Change current user password to authentication plugin

To change current user password to mysql_native_password authentication plugin, you need to login to MySQL command line and run the following command. Note that root is username and password is the password for that user.

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

Don’t forget to flush privileges:

FLUSH PRIVILEGES;

And that’s it, logout to MySQL command line:

quit;

Add new user with mysql_native_password authentication plugin:

To create a new user, login to MySQL command line and run the following command with username and password.

CREATE USER 'newuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

You may need to grant privileges to new user. If you want to give all privileges, run the following query.

GRANT ALL PRIVILEGES ON *.* TO ‘newuser’@'localhost';

Or you may grant specific privileges with following query:

GRANT CREATE, SELECT, INSERT ON *.* TO ‘newuser’@'localhost';

And reload the privileges:

FLUSH PRIVILEGES;

And close the MySQL connection:

quit;

After that, you can connect Node.js application with MySQL.

I hope this article will help you on your development.

Люди слишком длинные, и они думают, что они в отчаянии.

Я.

Navicat Premium соединять MySQL 8.0 Ошибка:

1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

 Navicat Premium  msyql8

2. Причины

MySQL 8.0 Измените метод аутентификации пароля.

существует MySQL 8.0 Метод аутентификации пароля предыдущей версии:

mysql_native_password

Чтобы предоставить более безопасные методы шифрования пароля, изMySQL 8.0 В начале версии метод аутентификации пароля по умолчанию:

caching_sha2_password

Сообщить об ошибке1251 Причина также очевидна:

Client does not support authentication protocol requested by server;

Перевод на китайский: «Клиент не поддерживает протокол аутентификации для запроса сервера”。

Я использую здесьNavicat Premium 11 СоединятьMySQL 8.0Поскольку версия слишком низкая, она не поддерживаетcaching_sha2_password Метод шифрования криптуры! Пересечение

существует MySQL Заказать терминал, вы можете просмотреть версию и метод сертификации пароля по умолчанию:

[email protected] r r:/# mysql -u root -p         
Enter password: 
Welcome to the MySQL monitor.  

mysql> 
mysql> 
#    
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.21    |
+-----------+
1 row in set (0.00 sec)

mysql> 
mysql> 
# Просмотреть метод шифрования по умолчанию
mysql> 
mysql> use mysql;

Database changed

mysql> 
mysql> select host, user, plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)

mysql> 

можно увидеть,MySQL 8.0 Метод шифрования всех пользователей по умолчаниюcaching_sha2_password

3. Решение

Есть два способа решить эту проблему.

  • Метод 1: изменитьMySQL 8.0 Метод аутентификации пароля.
  • Метод 2: Установите новую версиюNavicat Premium

Оба метода осуществимы, но правила шифрования лучше всего не измениться, легко иметь проблемы. так,Рекомендуется использовать «Метод 2».

3.1, изменитьMySQL 8.0 Метод аутентификации пароля

MySQL Клемма командной строки выполняет следующее:

# Обновите пароль пользователя root на «123456»,
# Обратите внимание, что вам нужно заменить «123456» на свой собственный пароль, пожалуйста, не используйте слабые пароли!
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

# Обновите разрешения, сделайте обновление пароля эффективным
FLUSH PRIVILEGES;

Простая демонстрация:

  • Шаг 1: Введитеmysql Командная строка терминала.
[email protected]:/# mysql -u root -p
Enter password: 

mysql> 
  • Шаг 2: Просмотреть метод сертификации пароля по умолчанию.
mysql> use mysql;
mysql> select host, user, plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)

mysql> 

можно увидеть,root Метод аутентификации пароля пользователяcaching_sha2_password

  • Шаг 3: изменитьroot Метод сертификации пароля пользователя, если это другие пользователи,root Просто замените его другими именами пользователей.Равно обновлять пароль!
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (0.05 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.04 sec)
  • Шаг 4: Просмотреть еще разroot Метод сертификации пароля пользователя.
mysql> select host, user, plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | mysql_native_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)

Внимательно следить,root Метод аутентификации пароля пользователя сталmysql_native_password

Используйте сноваNavicat Premium 11 соединять MySQL 8.0Соединение было успешным

Напоминание еще раз, изменение метода аутентификации пароля легко иметь проблемы, не рекомендуется!

3.2. Установите новую версиюNavicat Premium

Тест за мной,Navicat Premium 12 И вышеупомянутые версии поддерживаютMySQL 8.0 соединять. Последняя версияNavicat Premium 15, Официальный адрес загрузки веб -сайта:

http://www.navicat.com.cn/download/navicat-premium

Установка очень проста, запустите пакет установки и установите его шаг за шагом в соответствии с подсказками. К сожалениюNavicat Premium Не бесплатное программное обеспечение, постоянная цена лицензии дороже … … Официальная цитата на веб -сайте:RMB 4449,0Версия предприятия — даже десятки тысяч.Бедный, позволь мне пролить слезы, плакать


К счастью, вы можете взломать! Пересечение Пересечение
Для получения подробной информации, пожалуйста, см.Navicat Premium 15 Учебное пособие по установке постоянного растрескивания

Обратите внимание на соответствующую публичную учетную запись, и личные сообщения могут получить инструменты для взлома. Хотя это может взломать. Однако, если у вас есть деньги, рекомендуется поддерживать подлинность! Пересечение

Демонстрация: для технических обменов, если юридические споры не имеют никакого отношения ко мне. Если есть инвазивная версия, свяжитесь с Delete!

Прикрепите визуализации:

END.

Обычный программист двинулся вперед по дороге борьбы. Мне нравится что -то писать после работы, вовлеченПрограммированиеЖизньГорячая точкаЖдать. Заинтересованные друзья WeChat, вы можете искать: 【День программиста], Добро пожаловать, чтобы следовать и поддержать, спасибо!

Каждыйсконцентрируйсякак, Это отличная поддержка и поддержка. Наконец, спасибо за чтение! Это не легко, как это ~

Это не легко, как это ~

  • Ошибка client does not have permissions to send as this sender
  • Ошибка client dll мта
  • Ошибка cl25 mta province
  • Ошибка cl23 мта провинция
  • Ошибка cl11 mta province