In the actual production of coal mines, the transmission needs of existing underground applications cannot be met due to a lack of strategies and customized equipment for underground 5G application scenarios, which causes increased underground data processing delay and low transmission efficiency. To solve the problem above, the mobile edge computing (MEC) technology based on the 5G wireless base station is studied, and underground 5G communication capabilities is improved by edge caching and dynamic resource allocation according to the actual situation of coal mines. The experimental result shows that under the premise of maintaining the rated power and transmit power of the existing base station, the average delay of executing tasks is 15ms, which is 50% lower than the average delay of all local execution methods. The average delay is reduced by 37.5% than all MEC execution methods. At the same time, the uplink rate of a single base station can reach 1Gbps and the downlink rate can reach 1.5 Gbps. Our method can significantly improve the reliability of mining 5G communication systems and the rational allocation of resources.