Suggest specifying 'localhost' as host name part of the MySQL test
account name. Otherwise, the anonymous user that is usually created by
default for 'localhost' would take precedence for local connections due
to the more specific host name.
template1=# GRANT ALL PRIVILEGES ON DATABASE ejabberd_test TO ejabberd_test;
$ mysql
-mysql> CREATE USER ejabberd_test IDENTIFIED BY 'ejabberd_test';
+mysql> CREATE USER 'ejabberd_test'@'localhost' IDENTIFIED BY 'ejabberd_test';
mysql> CREATE DATABASE ejabberd_test;
-mysql> GRANT ALL ON ejabberd_test.* TO ejabberd_test;
+mysql> GRANT ALL ON ejabberd_test.* TO 'ejabberd_test'@'localhost';