Joy
Joy

Reputation: 4483

"Authentication plugin 'caching_sha2_password' cannot be loaded" while deploying docker with mysql

In my current project, I am using Airflow with Docker. As a DB backend, I am using MySQL. My MySQL connection config is as follows:

   DB_HOST = 'host.docker.internal'
   DB_PORT = 3306
   DB_USER = root
   DB_PASS = root
   DB_NAME = dev

While trying to deploy the webserver in local laptop, I am getting following error:

DB: mysql://root:***@host.docker.internal:3306/dev
Traceback (most recent call last):
....
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) 
(2059, "Authentication plugin 'caching_sha2_password' cannot be loaded: 
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/caching_sha2_password.so: 
cannot open shared object file: No such file or directory")

Being new to both Airflow and Docker, I don't have any idea how to debug this issue. Could anyone please give any pointer regarding this ?

Upvotes: 1

Views: 3142

Answers (1)

Orix Au Yeung
Orix Au Yeung

Reputation: 111

This is likely to be caused by the fact that from version 8.0 and onward, MySQL's default authentication plugin is caching_sha256_password rather than mysql_native_password.

As far as I am aware, at the moment Airflow doesn't support authentication through caching_sha256_password yet. As a workaround I would suggest to change your user to be authenticated through mysql_native_password, which can be changed by using the following command in mysql:

UPDATE USER 'your_user_name'@'%' IDENTIFIED WITH mysql_native_password BY 'your_user_password';

Upvotes: 1

Related Questions