I had the same problem for the last 3 days. On a fresh Debian 9 install using the Easy installer.
I was putting the mysql configuration entries in /etc/mysql/my.cnf but I kept getting the same error even though, like the OP, when querying mysql it was showing Barracuda as the main storage engine.
The solution was to put the configuration in this file: “/etc/mysql/mariadb.conf.d/erpnext.cnf”
The solution was suggested by wava in this thread: Ubuntu 16.04 bench newsite error - #13 by Tuan_Nguyen