ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded

I am trying to upgrade new tutor 18.0.0. I was able to build all images without any issues. But the problem is the connecting mysql database. I really appriciate for any help.

ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded
    [10/10] Waiting for MySQL service (this may take a while)...
MySQL initialisation error
Error: Command failed with status 1: docker compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm mysql-job sh -e -c echo "Initialising MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="xxx" --host "mysql" --port 3306 -e 'exit'
do
    mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
    echo "    [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
    if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
    then
      echo "MySQL initialisation error" 1>&2
      exit 1
    fi
    sleep 10
done
echo "MySQL is up and running"

it seems like this is due to the change mysql image. It was running before feat!: upgrade mysql to 8.4.0 (#1071) · overhangio/tutor@3d5e8fa · GitHub

Hi. As mentioned in the PR, the mysql_native_password is deprecated and does not impact the version upgrade. Are you running MySQL externally? Or is it happening in the containerized environment?

@Syed_Muhammad_Dawoud I am running MYSQL along with tutor.

Right. Can you share the steps you took to upgrade/install v18?

I upgarded with an instruction as mention:

pip install --upgrade "tutor[full]"
tutor local stop
sudo rsync -avr "$(tutor config printroot)"/ /tmp/tutor-backup/
tutor config save
tutor images build all # list the images that should be rebuilt here
tutor local upgrade --from=quince
tutor local launch

Hi. I’m sorry to hear you’re facing this issue.

it seems like this is due to the change mysql image. It was running before [feat!: upgrade mysql to 8.4.0 (#1071) · overhangio/tutor@3d5e8fa · GitHub ]

Mysql 8.4.0 does not enable the mysql-native-password plugin by default anymore so it is likely this could be the reason.

The upgrade instructions you’ve followed seem to be fine. Can you mention what version of tutor you are upgrading from to 18.0.0 so that I can test it out myself. Can you also mention what plugins(if any) that you have enabled?

@Danyal_Faheem Thanks for quick response. I am upgrading from tutor v16.1.0

@Syed_Muhammad_Dawoud Note: this is going to break people who are running with the MySQL fix to get around the Open edX regression where it broke emoji support: Upgrading MySQL charset to utf8mb4 - #4 by dave

I happen to be trying to upgrade a system to Palm with that plugin enabled, and I started running into the same error.

Specifically, the plugin provided by tutor plugins install https://gist.githubusercontent.com/Abdess/3ed9ed1d42821d00a5cf2481870df26f/raw/tutor-mysql8utf8mb4.yml
is set to override to image: docker.io/mysql:latest.

I’m going to try and set it to image: docker.io/mysql:8.1.0 (the way it was before that PR) so I can work around this. I had already upgraded my server and it got 8.4.0 and then couldn’t downgrade back.

But if that doesn’t work with 8.1, and I really need 8.4 on Palm, then how can I adjust that plugin parameters to make it work? I tried adding --mysql-native-password=ON but then I started getting ERROR 2007 (HY000): Protocol mismatch; server version = 11, client version = 10 instead, which I couldn’t figure out a way around…

I resolved by adding " --mysql-native-password=ON" in tutor/templates/local/docker-compose.yml under mysql settings.

  • For connection strings charset update, we already have a PR merged and a new version released (v18.1.0) for that feat!: upgrade default mysql charset and collation to utf8mb4 by Danyal-Faheem · Pull Request #1084 · overhangio/tutor · GitHub. This will update it for connection only, we will be merging a PR later to upgrade columns and tables to new charset and collations accordingly.
  • –mysql-native-password=ON is only needed if the underlying DB user plugins have this instead of caching_sha2_password? I am not currently sure under what circumstances a db plugin would have sha2 vs native. Regardless, we know native-password will be deprecated soon by MySQL.
1 Like

Tutor 18.1.1 has been released to fix this issue tutor · PyPI

This error mysql_native_password occurs because the plugin is disabled by default in MySQL 8.4+.
Follow two Methods described above to enable it. If the error persists

Ensure the plugin is loaded by checking:

SHOW PLUGINS;

Validate that the configuration file uses the correct syntax and section ([mysql] or [mysqld]).

2 Likes

In Tutor v19.0.2, a do command has been added that can help migrate auth plugin of existing users to caching_sha2_password from mysql_native_password. Please see: