Abstract Astrophysical plasmas are turbulent and magnetized. The interaction between cosmic rays (CRs) and magnetohydrodynamic (MHD) turbulence is a fundamental astrophysical process. Based on the current understanding of MHD turbulence, we revisit the trapping of CRs by magnetic mirrors in the context of MHD turbulence. In compressible MHD turbulence, isotropic fast modes dominate both trapping and gyroresonant scattering of CRs. The presence of trapping significantly suppresses the pitch-angle scattering and the spatial diffusion of CRs along the magnetic field. The resulting parallel diffusion coefficient has a weaker dependence on CR energy at higher energies. In incompressible MHD turbulence, the trapping by pseudo-Alfvén modes dominates over the gyroresonant scattering by anisotropic Alfvén and pseudo-Alfvén modes at all pitch angles and prevents CRs from diffusion.