Timely myocardial reperfusion salvages ischemic myocardium from infarction, whereas reperfusion itself induces cardiomyocyte death, which is called myocardial ischemia/reperfusion (MI/R) injury. Herein, β-carboline derivative <b>17c</b> was designed and synthesized with obvious myocardial protective activity for the first time. Pretreatment of <b>17c</b> effectively protected the cardiomyocyte H9c2 cells from H<sub>2</sub>O<sub>2</sub>-induced lactate dehydrogenase leakage and restored the endogenous antioxidants, superoxide dismutase (SOD) and glutathione peroxidase (GSH-Px). Besides, <b>17c</b> effectively protected the mitochondria through decreasing the reactive oxygen species overproduction and enhancing the mitochondrial membrane potential. As a result, <b>17c</b> significantly reduced the necrosis of cardiomyocytes in H<sub>2</sub>O<sub>2</sub>-induced oxidative stress, which was more potent than polydatin. In MI/R injury rats, <b>17c</b> pretreatment obviously increased the levels of SOD and GSH-Px and inhibited the apoptosis of cardiomyocytes. Through this way, the size of myocardial infarction was significantly reduced after MI/R injury <i>in vivo</i>, better than that of polydatin, suggesting that <b>17c</b> is a promising cardioprotectant for the prevention of MI/R injury.