Added logging to main and db part, and using official mysql/connect (supports p3)