snort/snort-createmysql-archive

12 lines
508 B
Bash

#!/bin/bash
mysqladmin create snort_archive
cat << EOF | mysql -u root snort_archive
grant INSERT,SELECT on root.* to snort@localhost;
SET PASSWORD FOR snort@localhost=PASSWORD('$1');
grant CREATE,INSERT,SELECT,DELETE,UPDATE on snort_archive.* to snort@localhost;
grant CREATE,INSERT,SELECT,DELETE,UPDATE on snort_archive.* to snort;
exit
EOF
mysql -u root < /usr/share/snort/contrib/create_mysql snort_archive
bzcat /usr/share/snort/contrib/snortdb-extra.bz2 | mysql -u snort --password="$1" snort_archive