Bug #90676 error no. 2058 collision / double-use
Submitted: 28 Apr 2018 8:55 Modified: 2 May 2018 9:00
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[28 Apr 2018 8:55] Peter Laursen
Description:
According to https://dev.mysql.com/doc/refman/5.5/en/error-messages-client.html error 2058 is "This handle is already connected. Use a separate handle for each connection."

However the error "Plugin <some authentication plugin> could not be loaded: The specified module could not be found." also has error no. 2058

How to repeat:
Create a user that IDENTIFIES WITH caching_sha2_password - next conenct with a client that does not have plugin support for this particular authentication method.  You will get "error 2058: Plugin caching_sha2_password could not be loaded: The specified module could not be found." 

Suggested fix:
No idea.
[28 Apr 2018 8:57] Peter Laursen
Error as appearing in SQLyog. But pre-MySQL_8 CLI should also reproduce.

Attachment: e2058.PNG (image/png, text), 28.96 KiB.

[29 Apr 2018 22:34] MySQL Verification Team
Thank you for the bug report. Please read:

https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html

"
Important

In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password. For information about the implications of this change for server operation and compatibility of the server with clients and connectors, see caching_sha2_password as the Preferred Authentication Plugin."

https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-cachin...

 Important

If your MySQL installation must serve pre-8.0 clients and you encounter compatibility issues after upgrading to MySQL 8.0.4 or later, the simplest way to address those issues and restore pre-8.0 compatibility is to reconfigure the server to revert to the previous default authentication plugin (mysql_native_password). For example, use these lines in the server option file:

[mysqld]
default_authentication_plugin=mysql_native_password

That setting enables pre-8.0 clients to connect to 8.0 servers until such time as the clients and connectors in use at your installation are upgraded to know about caching_sha2_password. However, the setting should be viewed as temporary, not as a long term or permanent solution, because it causes new accounts created with the setting in effect to forego the improved authentication security provided by caching_sha2_password. 

Then looks expected behavior. Thanks.
[30 Apr 2018 4:50] MySQL Verification Team
I am pasting a relevant part of the docs.  Firstly,  it seems like 2059 is what the docs state is returned so why you're seeing 2058 which is a wrong code?

https://dev.mysql.com/doc/refman/8.0/en/error-messages-client.html

Error: 2058 (CR_ALREADY_CONNECTED)
Message: This handle is already connected. Use a separate handle for each connection.

Error: 2059 (CR_AUTH_PLUGIN_CANNOT_LOAD)
Message: Authentication plugin '%s' cannot be loaded: %s
[30 Apr 2018 6:58] MySQL Verification Team
According the screenshot you attached is returned 2058 when should be 2059 according the documentation:

miguel@tikal:~/dbsd $ 5.6/bin/mysql -uroot -p --socket=/tmp/mysql80.sock
Enter password:
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /home/miguel/dbsd/5.6/lib/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
[30 Apr 2018 7:35] MySQL Verification Team
Which client library was used to link with your tool, because testing with the mysql command I get 2059 error:

C:\dbs\5.5\bin>mysql -uroot -p
Enter password: **********
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.

Thanks.
[30 Apr 2018 8:24] Peter Laursen
Ahh .. good point!  

The client libray is MariaDB Connector/C v. 2.3.3. So this should be complained about to MariaDB instead!
[30 Apr 2018 8:28] MySQL Verification Team
Thank you for the feedback. Please test with a tool linked with our library if you will get 2059 then the reporter will be closed as !bug. Thanks.
[2 May 2018 9:00] Peter Laursen
MariaDb confirmed that this is an issue with their Connector/C v. 2.x: It is fix in 3.x but not yet backported to 2.x.

So closing!