We present a numerical study of the Kelvin-Helmholtz instability for 2D and 3D shear flow configuration in compressible magnetohydrodynamics. The 2D results consider an initial magnetic field aligned with the shear flow, either unidirectional or changing sign at the interface. In the latter case, the initial current sheet gets amplified by the vortex flow and can become unstable to tearing instabilities forming magnetic islands. The 3D simulations consider shear flow in a cylindrical magnetized jet. The growth of linear perturbations at specified poloidal and axial mode numbers leads to induced secondary Kelvin-Helmholtz instabilities at higher mode numbers. The initially weak magnetic field becomes locally dominant in the non-linear dynamics before and during saturation. Thereby, it controls the jet deformation.