Bombyx mori cecropin A (Bmcecropin A) has antibacterial, antiviral, anti‐filamentous fungal and tumour cell inhibition activities and is considered a potential succedaneum for antibiotics. We clarified the antibacterial mechanism and structure–activity relationships and then directed the structure–activity optimization of Bmcecropin A. Firstly, we found Bmcecropin A shows a strong binding force and permeability to cell membranes like a detergent; Bmcecropin A could competitively bind to the cell membrane with the cell membrane‐specific dye DiI, then damaged the membrane for the access of DiI into the cytoplasm and leading to the leakage of electrolyte and proteins. Secondly, we found Bmcopropin A could also bind to and degrade DNA; furthermore, DNA library polymerase chain reaction (PCR) results indicated that Bmcecropin A inhibited DNA replication by non‐specific binding. In addition, we have identified C‐terminus amidation and serine‐lysine‐ glycine (SLG) amino acids of Bmcecropin A played critical roles in the membrane damage and DNA degradation. Based on the above results, we designed a mutant of Bmcecropin A (E9 to H, D17 to K, K33 to A), which showed higher antibacterial activity, thermostability and pH stability than ampicillin but no haemolytic activity. Finally, we speculated that Bmcecropin A damaged the cell membrane through a carpet model and drew the schematic diagram of its antibacterial mechanism, based on the antibacterial mechanism and the three‐dimensional configuration. These findings yield insights into the mechanism of antimicrobial peptide–pathogen interaction and beneficial for the development of new antibiotics.