MySQL Plugin Utility – How to Use for Authentication and Authorization

authenticationauthorizationmariadb-10.3MySQLplugins

I tried to follow this official documentation to install unix_socket plugin using mysql_plugin utility but getting an error that

Cannot read plugin config file unix_socket. Bad format in plugin
configuration file.

FROM alpine:edge

RUN set -ex \
&& apk add mariadb mariadb-client \
&& mysql_install_db --user=mysql --skip-name-resolve \
&& echo 'auth_socket' >> /usr/lib/mariadb/plugin/unix_socket.ini  \
&& mysql_plugin --basedir=/usr --datadir=/var/lib/mysql --plugin_dir=/usr/lib/mariadb/plugin unix_socket ENABLE   

CMD ["mysqld"]

I cross checked the ini file.

cat /usr/lib/mariadb/plugin/unix_socket.ini
auth_socket

Best Answer

The .ini needs to contain the plugin followed by the components.

The document Authentication Plugin - Unix Socket hints that the component name is unix_socket.

So the correct contents of the file should be:

echo -e 'auth_socket\nunix_socket' >> /usr/lib/mariadb/plugin/unix_socket.ini

As a workaround use plugin-load=auth_socket in /etc/my.cnf.d/mariadb-server.cnf seems also sufficient.