In 190, dissenting officials formed a coalition against the Dong Zhuo, who controlled the child emperor . Dong Zhuo was concerned that the capital Luoyang was not as easy to defend as Chang'an to the west, and thus moved all civilians and court officials, including the emperor, to Chang'an while the military under Dong Zhuo stayed to defend Luoyang. During the mass relocation on April 9, Dong Zhuo ordered his soldiers to raze Luoyang, confiscate from the rich, and looted from the Han emperor tombs. According to the ''Records of the Three Kingdoms'', the people who died during the relocation was "beyond measure".
Cao Cao, stationed in Suanzao , saw this as an opportunity to attack Dong Zhuo and announced to the dormant alliance:
Apparently, Cao Cao did not manage to rally anyone else in the alliance except his personal friend under Zhang Miao. Nonetheless, the detachment marched west from Suanzao with the intention to occupy Chenggao.
Cao Cao and Wei Zi's armies advanced to the Bian River at Xingyang, an important staging post en route to Luoyang, and met the opposing army led by Xu Rong there. In a day of fierce fighting, the coalition force was heavily defeated and Wei Zi was killed. Also, Cao Cao was hit by a stray arrow and his horse was injured. A younger cousin, Cao Hong, offered Cao Cao his horse but Cao Cao would not accept at first. Cao Hong then said, "The empire can do without me, but it cannot do without you." Cao Hong then followed Cao Cao on foot and they withdrew back to Suanzao by night.
Xu Rong considered an attack on Suanzao, but he observed that even though Cao Cao's men were few in number they fought fiercely throughout the day, and so assumed that an attack on Suanzao against these sort of men would be difficult. He, too, withdrew.
Cao Cao returned to Suanzao to see the warlords feasting every day with no intention of attacking Dong Zhuo, he reproached them. Learning from his defeat in Xingyang where he tried to attack Chenggao head-on, Cao Cao came up with an alternate strategy and presented it to the coalition:
Instead of attempting another direct attack from Suanzao, the plan involved taking strategic points to blockade Luoyang and Chenggao. Then Yuan Shu, the coalition general in the south could, instead of attacking Luoyang, threaten Dong Zhuo's new capital in Chang'an. The coalition would position themselves behind fortifications and avoid actual fighting. This arrangement, Cao Cao argued, could show the world that the coalition is on the move while applying pressure on Dong Zhuo's court. In this, Cao Cao was hoping that Dong Zhuo's government would eventually become over-strained, lose credit and collapse. Cao Cao concluded his plan with the words, "Our men have come to us because the cause is just, but if we hesitate and delay we shall lose the hopes of the empire, and I would be ashamed
However, the generals in Suanzao would not agree to his plan. Cao Cao abandoned the generals in Suanzao to gather troops in the Yang province with Xiahou Dun, then went to camp with the coalition commander-in-chief Yuan Shao in . Soon after Cao Cao's departure, the generals in Suanzao ran out of food and dispersed, some even fought amongst themselves. The coalition camp in Suanzao collapsed on itself.
In ''Romance of the Three Kingdoms''
In the historical romance ''Romance of the Three Kingdoms'' by Luo Guanzhong, the coalition were successively victorious and pressed on Luoyang. Dong Zhuo asked his aid Li Ru for advice, and Li Ru replied that he should move the capital to Chang'an. Dong Zhuo did so and burned Luoyang to the ground to force everyone to leave. The coalition generals saw the smoke coming from Luoyang and advanced, only to find the charred ruins of Luoyang.
Cao Cao went to Yuan Shao and said that the coalition should pursue Dong Zhuo, but Yuan Shao replied that everybody was worn out and there would be nothing to gain by pursuing, and all the lords agreed that they should do nothing. After this Cao Cao exclaimed, "These unworthy people cannot discuss worthy things!" Cao Cao then took Xiahou Dun, Xiahou Yuan, Cao Hong, Cao Ren, Li Dian, Yue Jin, and 10,000 troops to chase in pursuit.
In the novel, the road west from Luoyang to Chang'an was through Xingyang . When Dong Zhuo reached Xingyang, Xu Rong welcomed him. Li Ru, hearing of Cao Cao's approach, suggested to lure Cao Cao into an ambush with Lü Bu. In Xingyang, Cao Cao engaged Lü Bu, as predicted, and while Xiahou Dun was dueling Lü, Dong Zhuo's generals Li Jue and Guo Si attacked from both flanks and surrounded Cao Cao. Cao Cao ordered Xiahou Yuan and Cao Ren to hold them off, but Cao Cao's forces were eventually overwhelmed and retreated.
As Cao Cao's men were preparing to settle for the evening, Xu Rong came out of his ambush and scattered Cao Cao's camp. Cao Cao quickly mounted his horse to escape, but he was shot in the shoulder by Xu Rong and his horse was slain. Cao Cao became captured by two enemy soldiers but Cao Hong killed them and freed his master. Cao Hong offered his horse to Cao Cao, but there was a river ahead and Cao Cao could ride no more, while Xu Rong's men drew ever closer. Cao Hong then carried Cao Cao as he waded across the river. Xu Rong's men initially fired arrows at them, but soon turned around to cross the river in a ford upstream. When Cao Cao and Cao Hong finally reached the other side of the river, Xu Rong came charging from upstream, but Xiahou Dun intercepted and killed Xu Rong on the spot. Cao Cao's forces then came together, all relieved that Cao Cao is safe, and retreated back to Yuan Shao's main camp at Henei. Dong Zhuo's remaining forces left to follow Dong Zhuo to Chang'an.