Bobcares

How to Fix MySQL Error with Authentication Plugin ‘caching_sha2_password’?

by | Jul 27, 2024

An error between the client and server authentication methods is usually the cause of the MySQL error along with the authentication plugin ‘caching_sha2_password’. Read the article to learn more. At Bobcares, with our MySQL Support Service, we can handle your issues.

Overview
  1. Fixing MySQL Error with Authentication Plugin ‘caching_sha2_password’
  2. Reason for the Error
  3. How to Resolve the Error?

Fixing MySQL Error with Authentication Plugin ‘caching_sha2_password’

MySQL provides two authentication plugins that implement SHA-256 hashing for user account passwords:

1. caching_sha2_password:

i. This is the default authentication plugin in MySQL 8.0 and later versions.

ii. It implements SHA-256 authentication and uses server-side caching for better performance.

iii. It has additional features and is more secure compared to the older plugin.

mysql error authentication plugin 'caching_sha2_password'

2. sha256_password (deprecated):

i. This plugin also implements SHA-256 authentication but without the caching feature.

ii. It is deprecated and may be removed in future versions, so it’s not recommended to use this plugin.

When using caching_sha2_password, we may face the following error messages:

Authentication plugin ‘caching_sha2_password’ cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

Or,

Authentication plugin ‘caching_sha2_password’ cannot be loaded. The specific module cannot be found

Reason for the Error

As of MySQL 8.0, caching_sha2_password is the default authentication plugin instead of mysql_native_password, which was the default in previous versions. This change can cause connection issues with MySQL clients like Sequel Pro and HeidiSQL that rely on mysql_native_password.

How to Resolve the Error?

There are two main ways to resolve this issue: changing the default authentication plugin at the server level or changing it at the user level. Let’s see the details:

Option 1

In order to change the Default Authentication Plugin at the Server Level, run the following steps:

i. Locate the MySQL configuration file, which could be named my.cnf or my.ini depending on your operating system.

ii. Add or modify the following lines under the [mysqld] section:

[mysqld]
default_authentication_plugin=mysql_native_password

iii. After making the changes, restart the MySQL server to apply the new configuration.

Option 2

Now, to change the Authentication Plugin at the User Level, run the below steps:

i. Open a terminal window and connect to the MySQL instance using the command line:

mysql -u [USERNAME] -p

Replace [USERNAME] with the actual MySQL username.

ii. Enter the MySQL password when prompted.

iii. Once logged in, execute the following SQL command to change the authentication plugin for a specific user:

ALTER USER '[USERNAME]'@'[HOST]' IDENTIFIED WITH mysql_native_password BY '[PASSWORD]';

Replace [USERNAME], [PASSWORD], and [HOST] with our specific details:

iv. Run the following command to ensure the changes take effect:

FLUSH PRIVILEGES;

v. Try connecting again using the preferred MySQL client (e.g., Sequel Pro, HeidiSQL), and it should work with the mysql_native_password plugin.

[Want to learn more? Click here to reach us.]

Conclusion

To sum up, this should resolve most compatibility issues related to the new default caching_sha2_password plugin.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF