Can the MySQL authentication plugin used by PrismaDB be changed? - mysql

I'm getting the following error using PrismaDB.
Error: Error in connector: Error querying the database: Error querying the database: Error querying the database: Unknown authentication plugin sha256_password'.`
I know that changing my MySQL user authentication plugin will work.
ALTER USER 'my_user'#'localhost' IDENTIFIED WITH sha256_password BY 'my_password';
But the problem is I need root access to do that, and I don't have it. Is there a way to change the authentication plugin used by PrismaDB? In my case, use "mysql_native_password" instead of "sha256_password".

Related

Authentication plugin error when connecting to mySQL

I am learning PHP and just installed Sequel Pro. I am trying to make a connection but it
is giving a long error but last line says
MySQL said: Authentication plugin 'caching_sha2_password' cannot be
loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so, 2):
image not found
Before this, I was getting
MySQL said: Can't connect to MySQL server on '127.0.0.1' (61)
and I found mysql.server start on another SO thread but now it is Authentication plugin error.
I am using MacOS Big Sur on M1 chipset. Not sure why I am getting the error or how to fix it
You may try using the ALTER command to change the password instead which would help prevent the authentication plugin caching_sha2_password:
ALTER USER 'username'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Authentication plugin 'caching_sha2_password' is not supported using Flask-Sqlalchemy and MySQL

I'm connecting to MySQL (8.0) database with Flask here's the error:
Authentication plugin 'caching_sha2_password' is not supported
I created the database 'user' by this sql command:
ALTER USER 'my_user'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
quit;
I keep getting the same error though. How can I address this?
I suspect the legacy plugin can no longer be used as I tried to include it in my.cnf file and the MySQL server failed to start after relaunch.
Using this uri helped in my case:
'mysql+mysqlconnector://user:password#localhost/db?auth_plugin=mysql_native_password'

Sequelize does not suport the MySQL 8 autentication protocol and I'm not getting how to change this protocol

I'm trying to migrate a db with Sequelize working with MySQL 8.0.15, but I'm not able to do that. I keep receiving this error message.
Sequelize CLI [Node: 10.15.0, CLI: 5.4.0, ORM: 5.3.5]
Loaded configuration file "config/config.json".
Using environment "development".
ERROR: Client does not support authentication protocol requested by server; consider upgrading MySQL client
I've tried every single solution for this problem. The thing is when i try to change the MySQL root password the message i get is this one:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Then I did try to change the password validate policy following this procedure
https://dev.mysql.com/doc/refman/5.6/en/validate-password-installation.html
then MySQL crashed cause it's deprecated. Then I tried this one
https://dev.mysql.com/doc/refman/8.0/en/validate-password-installation.html
Then I got this
mysql> INSTALL COMPONENT 'file://component_validate_password';
ERROR 3529 (HY000): Cannot load component from specified URN:
'file://component_validate_password'.
Then I checked where the component is
ls /usr/lib64/mysql/plugin/component_v*
/usr/lib64/mysql/plugin/component_validate_password.so
Anyone can help? I'm realy out of options, now!
Thanks in advance
If you want to use MySQL 5.x style authentication, typically all you have to do is add this to your my.cnf:
[mysqld]
default_authentication_plugin=mysql_native_password
Do this before adding any users. Only use users for connecting via Sequelize, never root.
If you are using MySQL 8.0 then https://dev.mysql.com/doc/refman/5.6/en/validate-password-installation.html then this shouldn't work.
Have used mysql_secure_installation and installed the validate_password_component then?
If yes, in that case, the plugin must already be installed and all you need to do is set validate_password related parameters in the options file (default /etc/my.cnf) and some options require a server restart.
For those who cannot edit system variables (for instance, if you're using a managed database in AWS or DigitalOcean), this works as well:
ALTER USER 'foo'#'bar' IDENTIFIED WITH mysql_native_password BY 'password';
flush privileges;
Or, if you cannot run flush privileges; like me:
DROP USER 'foo'#'bar';
CREATE USER 'foo'#'bar' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT INSERT, SELECT, ... ON mydb.* TO 'foo'#'bar';

MySQL plugin Standard is not loaded

I was trying to reinstall MySQL server 8.0 in order to use legacy authentication method, but got the following error in log when installer was attempting to start the server:
MySQL error 0: Authentication to host 'localhost' for user 'root'
using method 'mysql_native_password' failed with message: Plugin
'Standard' is not loaded
How can i fix it?
caching_sha2_password is the default authentication mechanism in 8.0. So use a client that support this. Or using the mysql-8.0 client, create a new user using CREATE USER:
CREATE USER 'vyacheslav'#'localhost'
IDENTIFIED WITH mysql_native_password BY 'password';

ER_NOT_SUPPORTED_AUTH_MODE - sails 1.0 and MySQL 8.0

I'm trying to connect SailsJS with MySQL
default: {
adapter: require('sails-mysql'),
url: 'mysql://root:root#localhost/ventas'
},
But whenever I do a 'sails lift' I get the following error:
error: A hook (`orm`) failed to load!
error:
error: { error:
{ Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Handshake.Sequence._packetToError (C:\ticket\node_modules\mysql\lib\protocol\sequences\Sequence.js:48:14) }
I'm just using the web app template that comes with sails with no added code.
Any ideas?
The problem may be with encrypting the password. MySQL 8.0 uses caching_sha2_password. You need change it to mysql_native_password:
ALTER USER 'user' identified with mysql_native_password BY 'password';
The problem is coming from mysql, you need to change the plugin to mysql_native_password and then flush privileges;, see here and here.
Set your password to one with Upper case , lower case, numeric and a special character in it with 8 letters long .