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:
- Enable
mysql_native_password=ON
in the[mysqld]
section of the server configuration, which did not work in our tests. - 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.
Simply edit the MySQL configuration file:
nano /etc/mysql/conf.d/mysql.cnf
Add the following line in the
[mysql]
section:[mysql] mysql_native_password=ON
Restart the service:
systemctl restart mysql
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.
Edit the MySQL
systemd unit
:nano /etc/systemd/system/multi-user.target.wants/mysql.service
Add
--mysql-native-password=ON
to theExecStart=/usr/sbin/mysqld
line:ExecStart=/usr/sbin/mysqld --mysql-native-password=ON
Reload systemd daemons:
systemctl daemon-reload
Restart MySQL:
systemctl restart mysql
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: