Genetic variation in CLDN19, CNNM2, FXYD2, SLC41A2, and TRPM6 significantly influenced diabetes risk (p < 0.05), and for CNNM2, FXYD2, SLC41A2 and TRPM6 this risk was completely mediated by serum magnesium levels. This evidence concerns the gene CNNM2 and diabetes mellitus.