crystal-mysql icon indicating copy to clipboard operation
crystal-mysql copied to clipboard

connection failure to mysql 8

Open rdp opened this issue 6 years ago • 11 comments

Exception: packet 254 not implemented (Exception) from lib/mysql/src/mysql/connection.cr:29:9 in 'initialize' from lib/mysql/src/mysql/connection.cr:4:3 in 'new'

connecting to mysql 8 instance...

rdp avatar Jul 12 '18 06:07 rdp

I have same question when run amber db create output 'packet 254 not implemented' my amber version 0.11.3 mysql Ver 8.0.12 for osx10.13 on x86_64 Crystal 0.27.2 (2019-02-05) LLVM: 6.0.1 Default target: x86_64-apple-macosx crystal-mysql version 0.5.1

clarkyi avatar Feb 18 '19 11:02 clarkyi

@rdp @clarkyi if you could, please, test my branch, the one I opened the PR and give some feedback if works for you

fernandes avatar Mar 02 '19 14:03 fernandes

I use mysql 8 with --default-authentication-plugin=mysql_native_password and everything seems good

imdrasil avatar Mar 13 '19 07:03 imdrasil

Still a thing :( can we fix this?

bararchy avatar Aug 05 '19 12:08 bararchy

default_authentication_plugin with mysql_native_password will be deprecated. sha256_password will be default in the future.

Temporary solution: CREATE USER 'test'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypassword';

iambudi avatar Sep 23 '19 00:09 iambudi

Any update about this? Thank you.

iambudi avatar Jan 08 '20 17:01 iambudi

No that I am aware of.

You need to change the authentication plugin to mysql_native_password which is the old default.

The required steps is to implement the handshake of the password according to the caching_sha2_password auth plugin.

References:

  • https://github.com/go-sql-driver/mysql/pull/794/files
  • https://dev.mysql.com/doc/internals/en/connection-phase-packets.html
  • https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html
  • https://mariadb.com/kb/en/authentication-plugin-sha-256/
  • https://mariadb.org/history-of-mysql-mariadb-authentication-protocols/

Ideally, there should be a way to specify before hand the public key of the server. And not only the on-demand key exchange.

The branch https://github.com/bcardiff/crystal-mysql/tree/sha2_password can help as a starting point.

bcardiff avatar Jan 08 '20 19:01 bcardiff

Any solution for this yet? I'm seeing this error even after updating the plugin to mysql_native_password.

dansbits avatar Oct 31 '20 02:10 dansbits

You may need to reset the password as well

On Friday, October 30, 2020, Dan Carpenter [email protected] wrote:

Any solution for this yet? I'm seeing this error even after updating the plugin to mysql_native_password.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.< https://ci4.googleusercontent.com/proxy/fwlQlLLl8MFHGEOQaDaB0pSPzIF30Xoz2OHsmfquRS-Zr-UdpSXJ_kD_-dAkLhSJPB6Z-O-rkjFYeFT_UT3ULJxai3RiSL7tV92T9ledc0DaCG8zt1cIYv7jFarZL3oJCZaeM_6Si7OHlESelWz-9uiyaQHbgQdNHhDlB7-Sk8k9sQ7a3K2E6UtHhR7OzMzKlCHDeuaM7vjyhQdtZ0bwVN1juy8wGX84HfJjr-Go5Q=s0-d-e1-ft#https://github.com/notifications/beacon/AAADBUDCDSYJAE6FJSO5EM3SNNV6XA5CNFSM4FJRHDG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFLUFFJA.gif>

rdp avatar Oct 31 '20 15:10 rdp

Bump, 4 years and counting

matthewmcgarvey avatar Nov 15 '22 15:11 matthewmcgarvey

If you run mysql through homebrew on macos like I do, these are the steps I took to get it working:

  1. Open the plist that is used by homebrew start mysql (/usr/local/Cellar/mysql/8.0.31/homebrew.mxcl.mysql.plist was mine)
  2. Add <string>--default-authentication-plugin=mysql_native_password</string> to the ProgramArguments array
  3. Run brew services restart mysql
  4. Start your mysql client mysql -u root -p
  5. Change your password ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; (You can change it back after if you'd like)

After all that, it should work as expected.

matthewmcgarvey avatar Nov 15 '22 16:11 matthewmcgarvey