Provided are a benzamide derivative as shown in formula (I) or a pharmaceutically acceptable salt thereof, and the preparation method and use thereof for preparing a medicine for treating cancer, wherein the group definitions of formula (I) are as set out in the description.