A 10-year-old girl was among those wounded in the incident in Chengdu, the capital of Sichuan province, China Central Television reported, according to the Xinhua news agency.
The suspect was detained, police were quoted as saying.
The attack is the latest in a series of deadly incidents across China, where social tensions have risen in recent years against a backdrop of a widening income gap and abuses of public power.
At the end of last month, a mentally ill man stabbed three passers-by to death and wounded five others in the southern boom town of Shenzhen, while another knifeman killed five people in Henan over land and business disputes.
Earlier in July, a man in the southern region of Guangxi stormed an office enforcing China's one-child policy, stabbing two officials to death and wounding four after a row over his offspring.