MariaDB failed to start

Using Homebrew to install MariaDB, and got this eror when starting the server

$ mysql.server start
Starting MySQL
.161227 19:05:10 mysqld_safe Logging to '/usr/local/var/mysql/xxx.err'.
ERROR!

Mostly it is caused by previous installation of MySQL.

Manually remove /usr/local/var/mysql and reinstall MariaDB,
it will start normally.