In aqueous magnesium air batteries, the influence of the electrochemical behavior on pH of the electrolyte has not been investigated yet, which has a critical effect on the cell performance. We have monitored the evolution of the pH at various discharge current densities in situ in the Mg-air primary cells, which produce sparingly soluble magnesium hydroxide (Mg(OH)$_{2}$). These experiments show the temporal evolution of the pH of the electrolyte in the cell discharge, depending on the current density. The pH first increases rapidly to a maximum of pH 11 and then drops down slowly to the equilibrium at pH 10.7. At the peak pH oversaturation of Mg(OH)$_{2}$ is paramount, leading to the precipitation which balances the Mg(OH)$_{2}$ concentration in the electrolyte. This precipitation process coats both cathode and anode which leads to a decrease in cell efficiency and voltage. The results show that the cell design of Mg-air batteries is important for their lifetime and cell performance. The performance of the aqueous magnesium cell is increased several folds when the design is changed to a simple electrolyte flow cell.