Lianyungang was founded as Haizhou in 549 ce at a point somewhat farther east. It was already a centre of salt production in the 7th century. In Ming times (1368–1644) the prefecture there was subordinated to Huai’an, but from 1726 onward it was independent. At the time of the foundation of the republic in 1911, it became a county seat. Opened to foreign trade in 1905, it became a collecting centre not only for salt but also for agricultural produce from inland, which was shipped northeast to Qingdao (in Shandong province) and southeast to Shanghai.

Lianyungang’s modern growth began with the construction of the Longhai Railway, an east-west route running through Baoji, in Shaanxi province, in the Wei River valley. Haizhou was the eastern terminus, and a harbour was constructed in the estuary at Dapu. The estuary rapidly silted up, however, and in 1933 the railway was extended to the coast at a village called Laoyao, where a new port called Lianyungang was constructed in a location protected by Dongxilian Island. The port, which was built in 1933–36 by a Dutch company, encountered unexpected difficulties and also rapidly silted up. Part of the port was used by the Longhai Railway, the management of which was inefficient, and part by the Zhongxing Company to export coal from mines at Zaozhuang. Although the port was linked with places as far west as Xi’an in Shaanxi and was the centre of a network of canals, it did not grow rapidly, and it remained under the customs administration of Qingdao. The real growth of the city began with the Japanese occupation of the region in 1938. Although the Chinese had demolished much of the port before withdrawing, it was rebuilt and dredged. It handled large exports of coal, phosphates, iron ore, salt, and grain to Japan.

After 1949 Haizhou and its older river ports of Xinpu and Dapu were merged. They became the municipality of Xinhailian. In 1961 its name was changed to Lianyungang. The city has continued to grow as a port, and its facilities have been improved. Longhai Railway has been extended west to the border of the Uygur Autonomous Region of Xinjiang, and it is now linked to the railway networks of Central Asia and Europe. In addition to its importance in trade and transportation, Lianyungang has rapidly developing chemical and food-processing industries. The city was one of the first coastal cities to be opened to foreign investment in the 1980s. Pop. (2002 est.) city, 536,210; (2007 est.) urban agglom., 806,000.