Issue
The Contrast On-Premises log file mysql-error.log
is filled with millions of warning messages like this:
2024-12-10T10:32:46.735722Z 9 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
resulting in the file growing to several hundred MB in size.
Cause
A bug in the version of MySQL8 used in Contrast On-Premises may result in an older installation of Contrast which has been upgraded many times to have warning messages, as detailed above, fill the log with every database query.
The cause is that previous versions of MySQL used a password plugin known as mysql_native_password
but newer versions use the more secure caching_sha2_password
. Installations older than when that change was made will still specify the deprecated plugin.
Resolution
The resolution is simply to change the plugin as follows:
1: Gather the MySQL credentials
Username and password are contained within the $CONTRAST_HOME/data/conf/database.properties
file. This is an encrypted properties file, so to view it, you’ll need to use the Encrypted Properties Editor as follows (from the $CONTRAST_HOME
) directory:
bin/edit-properties -e data/esapi -f data/conf/database.properties
or, on Windows:
bin\edit-properties.exe -e data\esapi -f data\conf\database.properties
2: Connect to the database
From $CONTRAST_HOME
, run the following command:
sudo mysql/bin/mysql -u contrast -h 127.0.0.1 -P 13306 -p contrast
or, on Windows:
mysql\bin\mysql.exe -u contrast -h 127.0.0.1 -P 13306 -p contrast
(or use any other MySQL client to connect).
3: Update the plugin
Run the following query to change the plugin to the non-deprecated one:
ALTER USER 'contrast'@'%' IDENTIFIED WITH caching_sha2_password BY '<the contrast user's password>';