In this paper we consider a discontinuous Galerkin discretization of the ideal magnetohydrodynamics (MHD) equations on unstructured meshes, and the divergence free constraint ($\nabla \cdot \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 \cite{Li2005}, and another approach of the divergence cleaning technique given by Dedner et al. \cite{Dedner2002}. 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.