  From high-resolution spectra a non-LTE analysis of the MgII 4481.2 A feature
is implemented for 52 early and medium local B stars on the main sequence (MS).
The influence of the neighbouring line AlIII 4479.9 A is considered. The
magnesium abundance is determined; it is found that log e(Mg) = 7.67 +- 0.21 on
average. It is shown that uncertainties in the microturbulent parameter Vt are
the main source of errors in log e(Mg). When using 36 stars with the most
reliable Vt values derived from OII and NII lines, we obtain the mean abundance
log e(Mg) = 7.59 +- 0.15. The latter value is precisely confirmed for several
hot B stars from an analysis of the MgII 7877 A weak line. The derived
abundance log e(Mg) = 7.59 +- 0.15 is in excellent agreement with the solar
magnesium abundance log e_sun(Mg) = 7.55 +- 0.02, as well as with the proto-Sun
abundance log e_ps(Mg) = 7.62 +- 0.02. Thus, it is confirmed that the Sun and
the B-type MS stars in our neighbourhood have the same metallicity.
