#!/bin/bash

plugin=$(mysql --skip-column-names --batch -e 'use mysql;select plugin from user where user="root" and plugin="auth_socket";' 2>/dev/null)
[ $? -ne 0 ] && exit 0

if [ "${plugin##plugin}" = "auth_socket" ];then
    echo "Modification du plugin d'authentification pour l'utilisateur root";
    mysql -e 'use mysql;update user set plugin="mysql_native_password" where user="root";flush privileges;'
fi

exit 0
