Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Client Error: Authentication plugin not supported: caching_sha2_password #10

Open
hc2088 opened this issue Sep 18, 2023 · 1 comment

Comments

@hc2088
Copy link

hc2088 commented Sep 18, 2023

Future _handleData(Buffer buffer) async {
    _readyForHeader = true;
    _headerBuffer.reset();

    try {
      var response = _handler?.processResponse(buffer);
      if (_handler is HandshakeHandler) {
        _useCompression = (_handler as HandshakeHandler).useCompression;
        _useSSL = (_handler as HandshakeHandler).useSSL;
      }
      if (response?.nextHandler != null) {
        // if handler.processResponse() returned a Handler, pass control to that handler now
        _handler = response!.nextHandler;
        await sendBuffer(_handler!.createRequest());
        if (_useSSL && _handler is SSLHandler) {
          _log.fine('Use SSL');
          await _socket.startSSL();
          _handler = (_handler as SSLHandler).nextHandler;
          await sendBuffer(_handler!.createRequest());
          _log.fine('Sent buffer');
          return;
        }
      }

      if (response?.finished == true) {
        _log.fine('Finished $_handler');
        _finishAndReuse();
      }
      if (response?.hasResult == true) {
        if (_completer?.isCompleted == true) {
          _completer?.completeError(StateError('Request has already completed'));
        }
        _completer?.complete(response!.result);
      }
    } on MySqlException catch (e, st) {
      // This clause means mysql returned an error on the wire. It is not a fatal error
      // and the connection can stay open.
      _log.fine('completing with MySqlException: $e');
      _finishAndReuse();
      handleError(e, st: st, keepOpen: true);
    } catch (e, st) {
      // Errors here are fatal_finishAndReuse();
      handleError(e, st: st);
    }
  }
  handleError(e, st: st);

An exception is thrown when this line of code is executed

MySQL Client Error: Authentication plugin not supported: caching_sha2_password

@insinfo
Copy link
Owner

insinfo commented Oct 9, 2023

Have you tried this?

you can change the encryption of the password like this
ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'youpassword';

configure MySQL 8.0 to run in mysql_native_password mode
https://medium.com/@crmcmullen/how-to-run-mysql-8-0-with-native-password-authentication-502de5bac661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants