DEV Community

Jobayer Mojumder
Jobayer Mojumder

Posted on

How to solve Unknown variable 'default-authentication-plugin' in Laradock

In the latest version of MySQL, the previously common mysql_native_password authentication plugin is no longer enabled by default. This change reflects an ongoing shift towards more secure authentication methods. If your applications or services require the mysql_native_password plugin, you can reactivate it by modifying your server's startup configuration. Specifically, you can either pass the -mysql-native-password=ON option when starting the MySQL server or by adding the line mysql_native_password=ON directly to the [mysqld] section of your MySQL configuration file. This adjustment will override the default settings and re-enable the plugin, allowing legacy applications that depend on this authentication method to continue operating without disruption.

Solution

To ensure compatibility with older applications that rely on the traditional MySQL authentication method, it's necessary to make a slight adjustment in your MySQL configuration. Begin by removing the default-authentication-plugin entry from your mysql/my.cnf file. After removing it, you should explicitly add the entry mysql_native_password=ON to the configuration.
Code

After that rebuild your MySQL image by running docker-compose build mysql.

Reference
https://dev.mysql.com/doc

Top comments (0)