Chengdu was the capital of Shu and Han during the Three Kingdoms period. At the end of the Eastern Han Dynasty, the world was in turmoil, and the Han clan Liu Bei rose in the warlord melee. In the first year of Yankang (220), Cao Pi, the son of Cao Cao, usurped the Han Dynasty, and in the following year (22 1), Liu Bei proclaimed himself emperor in Shu, which continued the unification of the Han Dynasty.
Extended data:
It began with Emperor Liu Bei of Zhaolie, and ended with Emperor Huai of Han Dynasty (Liu Yuan pursued history) Liu Chan. The two emperors lived for forty-two years. At the end of the Eastern Han Dynasty, the struggle between consorts and eunuchs continued, which made state affairs increasingly corrupt, and then the Yellow Scarf Uprising broke out. Liu Bei entered his official career because he made great achievements in suppressing the peasant uprising.
But not long after, He Jin and Dong Zhuo were defeated, and the world situation gradually turned into a warlord melee. Liu Bei ran around in the melee. After Battle of Red Cliffs recovered all parts of Jingzhou, he advanced to capture Hanzhong and finally established the Shu-Han regime.
References:
Baidu Encyclopedia-Shu Kingdom