Barnyard2 not running in CentOS 7

I had some difficulties getting Barnyard2 to play with CentOS 7 when installing Snorby and Snort. Barnyard2 service stops shortly after I started it. First I thought it was related to SELinux, but then I checked the log file and found this:

“ERROR database: ‘mysql’ support is not compiled into this build of snort
ERROR: If this build of barnyard2 was obtained as a binary distribution (e.g., rpm,
or Windows), then check for alternate builds that contains the necessary
‘mysql’ support.
If this build of barnyard2 was compiled by you, then re-run the
the ./configure script using the ‘–with-mysql’ switch.
For non-standard installations of a database, the ‘–with-mysql=DIR’
syntax may need to be used to specify the base directory of the DB install.
See the database documentation for cursory details (doc/README.database).
and the URL to the most recent database plugin documentation.
Fatal Error, Quitting..
Barnyard2 exiting

How to fix
Make sure the MySQL service is running.

service mysql status

Make sure to run the commands below inside of the Barnyard2 directory.

./configure –with-mysql –with-mysql-libraries=/usr/lib64/mysql/
–with-mysql-includes=/usr/include/
make clean
make
make install
service barnyard2 restart
service barnyard2 status

If Barnyard2 is still running after 30 seconds or so, then the issue is solved.

service barnyard2 status

If Barnyard2 crashed, check the log file as it’s likely a authentication error. Check that the hostname, username and password for MySQL is correct, and then try again.
Hope this helps you, and feel free to drop a comment if this solution helped you in someway, or you have a different solution that worked for you.

Leave a Comment