The invention discloses an azithromycin derivative shown in the formula (I) and a pharmaceutically acceptable salt thereof, wherein R1 represents hydrogen, acetyl or benzoyl, R2 represents hydrogen, aliphatic hydrocarbon, substituted aromatic alkyl, substituted aromatic heterocyclic alkyl, halogen, nitryl, alkoxy or-AR7, R3 represents OR5, R4 represents hydroxyl; or, R3 and R4 can form a ring with a structure that X represents oxygen and nitrogen; R5 represents nitrogen or CONHR6, R6 represents aliphatic hydrocarbon, substituted aromatic alkyl or substituted aromatic heterocyclic alkyl, and R7 represents aliphatic hydrocarbon, substituted aromatic alkyl or substituted aromatic heterocyclic alkyl; n is from 1 to 6, A is one of -O-,-CO-,-CONR8-,-NHCO- and -S-. The invention further relates to a prepared intermediate and a method thereof, an acceptable salt thereof forming with inorganic or organic acid, a drug composite and application thereof in the treatment of bacterial infection.