Photos shared by local media showed a man in a black T-shirt and shorts walking across a football field carrying a long object they said was a knife.
A teacher and two parents were among the dead, AFP news agency quoted a city official as saying. Another person was also reported injured.
Reports of the attack were widely viewed on the microblogging website Weibo, attracting more than 340 million views within four hours.
Violent crime is relatively rare in China, and guns are mostly restricted to the military and police. But security has been beefed up in recent days due to sporadic stabbing attacks at schools.
In August last year, a 48-year-old man attacked a kindergarten in the eastern province of Jiangxi, killing three people and wounding six with a knife. Local police offered a $13,800 reward for information leading to his capture, but the man died in a car crash while trying to elude police.
The previous year, two children were killed and 16 injured in a stabbing attack at a kindergarten in Beiliu City, Guangxi Zhuang Autonomous Region. Following the attack, the Ministry of Education ordered to improve security in kindergartens, primary and secondary schools across the country.