SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MariaDB client

时间:2017-07-12 08:07:33

标签: mysql node.js database mariadb sequelize.js

I'm using Sequelize version 4.3.0 on nodejs(v6.11.0) application having Mariadb (mysql Ver 15.1 Distrib 10.0.29-MariaDB, for debian-linux-gnu (i686) using readline 5.2 ) on Ubuntu 16.04. when application starts and calls function: Sequelize.sync(); Then sequelize connection manager throws following error:

Unhandled rejection SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MariaDB client

at Utils.Promise.tap.then.catch.err (/home/dariksoft/cars/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:146:17)
at tryCatcher (/home/dariksoft/cars/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/dariksoft/cars/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/dariksoft/cars/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/dariksoft/cars/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/dariksoft/cars/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/home/dariksoft/cars/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/dariksoft/cars/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/dariksoft/cars/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)

I updated mariadb-server and mariadb-client but the problem already exists!

Anyone can help me to solve this problem ?

3 个答案:

答案 0 :(得分:2)

我找到了答案:

登录mysql命令行并编写以下命令:

use mysql;

update user set authentication_string=password(''),plugin='mysql_native_password' where user='root';

答案 1 :(得分:0)

在我的情况下,我需要键入以下三行:

use mysql;
update user set authentication_string=password('new_root_password'), plugin='mysql_native_password' where user='root';
flush privileges;

答案 2 :(得分:0)

如果您使用的是更高版本的mysql,则无需使用密码功能。相反,您可以将其编写如下

use mysql;

update user set authentication_string='new_root_password', plugin='mysql_native_password' where user='root';

flush privileges;