drush-ops / drush

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
https://www.drush.org
2.34k stars 1.08k forks source link

The mysql_native_password plugin is deprecated in MySQL 8.4 LTS and dropped in MySQL 9 #6111

Open bradfordbulger-nasa opened 2 months ago

bradfordbulger-nasa commented 2 months ago

Working with drush 12.5 setting up test copies of Drupal 10, I found that when I created a new database with drush sql:create, when I tried to access it I was getting errors about a missing plugin for mysql_native_password. Looking into it, I saw that I had upgraded mysql on my host machine (a Mac, mysql from homebrew) without thinking much about it, and it was the MySQL 9 client that was failing.

In Drush\Sql\SqlMysql::createdbSql() it is explicitly using the mysql_native_password plugin in a create user command: $sql[] = sprintf("CREATE USER %s IDENTIFIED WITH mysql_native_password;", $user);

It looks like this was introduced for #4259 although I am not clear on why.

MySQL deprecated the mysql_native_password plugin in 8.4 LTS, and dropped it in 9. I believe that MariaDB still supports this plugin, though they do not recommend it. For what that's worth.

I'd think that there needs to be some path available to users that does not use an obsolete plugin. But it was added in for a reason, and I don't know how that looks now.

weitzman commented 2 months ago

Some discussion at https://drupal.slack.com/archives/C62H9CWQM/p1726163171134629. Help wanted.

weitzman commented 2 months ago

Seems like nobody knows why the native plugin is specified. Feel free to submit a pr without it.