Disclosed are pyrimidinone compounds having formula (I), a preparation and use thereof. The compounds are inhibitors of HMG-CoA reductase, and therefore have antivirus activities and are useful for preventing and treating cardiovascular and cerebrovascular disorders, senile dementia, diabetes mellitus, osteoporosis and tumors, and enhancing immune functions in a subject, and especially useful for treating diseases associated with hyperlipaemia.