In this paper we consider a discontinuous Galerkin discretization of the ideal magnetohydrodynamics (MHD) equations on unstructured meshes, and the divergence free constraint (∇·B=0) of its magnetic field B. We first present two approaches for maintaining the divergence free constraint, namely the approach of a locally divergence free projection inspired by locally divergence free elements [19], and another approach of the divergence cleaning technique given by Dedner et al. [15]. By combining these two approaches we obtain a efficient method at the almost same numerical cost. Finally, numerical experiments are performed to show the capacity and efficiency of the scheme.