-1

I have installed XAMPP and created a MariaDB database and PHP files to access that database, and everything works fine. Now I am writing a C++ program to access the same database, but I get the error message:

Authentication plugin 'mysql_native_password' cannot be loaded. The specified module cannot be found.

I created a new user with authentication 'mysql_old_password' and get a similar error message. It seems that the current version of XAMPP doesn't ship with any plugins. Creating an empty folder for the plugins doesn't help.
If I try to change the authentication method to 'caching_sha2_password', the operation fails, as 'mysql_native_password' and 'mysql_shared_password' are the only two authentication methods permitted, and the plugins are no longer supported.

So is it possible to do this with C++?

1
  • 1
    I would check whatever database connector you have on the client side for the plugins. It nay be too new and not have legacy plugins. You may also want to check if you use a mariadb driver or a mysql one. If the latter, then you may want to swap to the former... Commented Mar 12 at 23:07

2 Answers 2

0

Not really an answer, but too long for a comment....

Some clarifications:

XAMPP package contains a MariaDB Database, which doesn't support authentication via caching_sha2_password - this authentication method is supported by MySQL only.

mysql_old_password authentication is used to connect to a MySQL Server < 4.1 and shouldn't be used at all unless you want to connect to a server which was released mostly 20 years ago.

mysql_native_password is the default authentication method in MariaDB - when using/linking against MariaDB Connector/C it is statically linked (and not a dynamically loaded via .so/.dll). mysql_native_password is disabled in MySQL since version 8.0.34

m̀ysql_shared_password doesn't exist at all - neither in MySQL nor MariaDB.

Since your C++ application connects to the server but fails to authenticate, my guess (as Shadow mentioned in his comment) is that your C++ application was linked with libmysql (>= 8.0.34) but not with libmariadb (MariaDB Connector/C).

Sign up to request clarification or add additional context in comments.

2 Comments

Can the MariaDB Connector be used with Microsoft Visual Studio? I tried that first, but I couldn't get it to work with Visual Studio, so that's why I used the other one, which is probably why it isn't working. Is there any documentation on using MariaDB connection with Visual Studio, or would I have to use the GNU compiler?
-1

I switched back to MariaDB connector, got it working, and now it works.

The reason it wasn't working was that I was using the wrong database connector. I needed to use the database connector specifically for MariaDB. I chose the other one because it seemed easier to use, but it was not compatible. But, as it turned out, the MariaDB connector wasn't difficult to configure. I simply had to add the line secure_auth=OFF to the my.ini file. I could always change that later, but, for now, it got it working.

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
The reason it wasn't working was that I was using the wrong database connector. I needed to use the database connector specifically for MariaDB. I chose the other one because it seemed easier to use, but it was not compatible. But, as it turned out, the MariaDB connector wasn't difficult to configure. I simply had to add the line secure_auth=OFF to the my.ini file. I could always change that later, but, for now, it got it working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.