The awk portion of your script is adding a comma between the date and time portions of what you want to be formatted as datetime. This is causing "YYYY-MM-DD HH:MM:SS" to appear as "YYYY-MM-DD,HH:MM:SS".
To get the result you're after change your script to:
awk '{print $1" "$2","$4","$5","$8","$9","(substr($11,1,7))","$12 }' access_log | grep cid= | sed -e 's/\/data//g;s/\/videos//g;s/\/images//g;s/\/hls//g;s/\/rss//g;s/\/xml//g;s/cid=//g' > stats.txt
This should insert into the datetime field correctly.