Risk analysis, as an important prerequisite of risk management, is critical to reducing occupational injuries and other related losses. However, suffering greatly from incomplete hazard identification and inaccurate probability analysis, risk analysis is considered the weakest link in risk management, which seriously affects risk evaluation and control in complex workplaces. To improve the performance of hazard identification and analysis, a data-driven risk analysis approach is established, which consists of an improved equivalent class transformation (Eclat) algorithm, a sliding window model, and a change pattern mining algorithm. Through this approach, a large number of historical hazard records are transformed into association rules composed of object keywords and deviation keywords, and information such as potential keyword combinations, conditional probabilities of potential deviations, and the change pattern of potential hazards can be extracted. The function of the approach is threefold. Firstly, the data-driven risk analysis process is designed to identify the association rules between different hazard keywords. Secondly, Eclat algorithm is optimized to calculate the frequency and probability of potential hazards, which is conducive to improving the accuracy of probability estimation. Thirdly, the change pattern is developed to analyse the hazard change trend to support the cause analysis. A practical application in a Chinese hazardous chemical manufacturer is presented. Case studies have shown that the efficiency of the improved algorithm is increased by 13.68%, and 59.66% of potential hazards can be identified in advance, and relevant information can be extracted to support risk analysis.