Write data to mysql