Be and Mg do not react with water. This is because of:
Be and Mg are kinetically inert to water due to the formation of protective oxide film on the surface of it.
Magnesium — is a chemical element with the symbol of Mg with atomic number 12 one of the alkaline-earth metals of group 2 of the periodic table, and the lightest structural metal
Beryllium — is a chemical element with the symbol Be and atomic number 4 it is a steel-grey, strong, lightweight, and brittle alkaline earth metal and physical and chemical properties similar to those of Mg
In general rule — if a metal reacts with cold water, the metal hydroxide is produced. if it reacts with steam, the metal oxide is formed
Thus, Be and Mg do not react with water because Be and Mg are kinetically inert to water due to the formation of protective oxide film on the surface of it.