The degree of informatization of coal mine safety management is becoming higher and higher, and a large amount of information is generated in this process. How to convert the existing information into useful data for risk control has become a challenge. To solve this challenge, this paper studies the mathematical model of coal mine risk early warning in China based on data mining. Firstly, the coal mine risk data was comprehensively analyzed to provide basic data for the risk prediction model of data mining. Then, the adaptive neuro-fuzzy inference system (ANFIS) was optimized twice to build the coal mine risk prediction model. By optimizing the calculation method of the control chart, the coal mine risk early warning system was proposed. Finally, based on the coal mine risk early warning model, the software platform was developed and applied to coal mines in China to control the risks at all levels. The results show that the error of the optimized ANFIS was reduced by 66%, and the early warning error was reduced by 57%. This study aimed to provide implementation methods and tools for coal mine risk management and control, and data collected has reference significance for other enterprises.