Beryllium has simple atomic configuration, but its fundamental physical properties, such as its phase diagram, is poorly understood. Here we investigate the solid-liquid phase transition of beryllium at high pressure based on quantum molecular dynamics. The melting temperature is achieved from the two-phase method. Two solid phases of hcp and bcc are used to compare the influence of structures. It is found that the hcp phase is more stable than the bcc phase near melting, but the difference of their melting temperatures decreases with the increasing pressure. Our results are in good accordance with the previous DAC experiments.