0.) configuring logging of traffic by using iptables "-j LOG" rules, and
1.) configuring your database of choice with the right scheme, and
2.) configuring the syslog daemon to log (only) these messages (facility and priority or string match) to the database.
As far as guidance is concerned this should be a simple DIY exercise as log as you invest time reading 'man iptables' (LOG target), the manual page for your syslog daemon and the (on or offline) syslog daemons documentation explaining how to configure logging to MySQL.