Salta al contenuto principale

Fix MySQL Plugin 'mysql-native-password' is not loaded

MySQL since version 8.4, implements the mysql-native-password authentication, which, at the time of writing, has issues when installing on Debian 12 and Ubuntu due to the lack of the necessary plugin. Let’s see how to enable it.

MySQL Plugin 'mysql-native-password' is not loaded

During the installation of MySQL 8.4, this error is common due to the missing native-password plugin:

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

MySQL 8.4 and later implement mysql-native-password authentication, which, at the time of writing, has issues when installing on Debian and Ubuntu.

The official documentation suggests two possibilities:

  1. Enable mysql_native_password=ON in the [mysqld] section of the server configuration, which did not work in our tests.
  2. Start the service with --mysql-native-password=ON.

Start the server with --mysql-native-password=ON (added in MySQL 8.4.0), or by including mysql_native_password=ON in the [mysqld] section of your MySQL configuration file.

a. Enabling mysql_native_password in MySQL configuration

The simplest and most commonly used solution to resolve the ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded error is to modify the MySQL configuration file and enable the mysql_native_password plugin.

  1. Simply edit the MySQL configuration file:

    nano /etc/mysql/conf.d/mysql.cnf
  2. Add the following line in the [mysql] section:

    [mysql]
    mysql_native_password=ON
  3. Restart the service:

    systemctl restart mysql
  4. Test the authentication:

    mysql -u root -p

b. Starting MySQL with --mysql-native-password=ON in systemd

Even after modifying the server configuration, you may still encounter the ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded. In this case, we need to modify the systemd unit that manages MySQL startup.

  1. Edit the MySQL systemd unit:

    nano /etc/systemd/system/multi-user.target.wants/mysql.service
  2. Add --mysql-native-password=ON to the ExecStart=/usr/sbin/mysqld line:

    ExecStart=/usr/sbin/mysqld --mysql-native-password=ON
  3. Reload systemd daemons:

    systemctl daemon-reload
  4. Restart MySQL:

    systemctl restart mysql
  5. Test the authentication:

    mysql -u root -p

Configuring mysql-native-password

More details about mysql-native-password and native-pluggable-authentication are available in the official MySQL documentation at the following link:

Aggiungi un commento

Comment

  • Elementi HTML permessi: <br> <p> <code class="language-*"> <pre>
  • Linee e paragrafi vanno a capo automaticamente.
  • Solo le immagini ospitate su questo sito possono essere utilizzate nel tag <img>.