Note that none of this is to say that there weren't also evolutionary views in ancient times. There were. And that this isn't about whether the YEC view is true, it's about whether it was a belief that existed, as the primary belief among Christians (and in Judaism), long before the modern scientific views of origins.
I'd also like to point out that my comment on the other answer didn't say it was the primary view held by everyone. Just that the view pre-dated modern scientific views. It would be foolish to argue that a Biblical YEC view, based on the Genesis account was widely held by anyone outside Judaism or Christianity
The modern YEC view has several variants, but there are two main points on which YEC'ers agree, which can easily be shown to have been a common belief: A young earth, and flood geology (also creation geology or diluvial geology)
Of course, the people that held this view didn't call it "young earth creationism". They simply called it history. People simply believed the Bible, and it wasn't until people came along to introduce modern ideas like uniformitarianism and an old earth, that the idea that the Bible might be wrong even occurred to Christians.
Case in point: Charles Lyell's book "Principles of Geology" (available for online reading here in pdf form) is the book that introduced the idea of Uniformitariansim, and was one of the first scholarly book addressing geology from a "scientific" view. In chapter three, he states:
It had been the consistent belief of the Christian world, down to the
period now under consideration, that the origin of the planet was not
more than a few thousand years; and that since the creation deluge was
the only great catastrophe by which considerable change had been
wrought on the earth's surface.
It was simply common knowledge at the time that Christians believed in a young earth, and flood geology.
Of course, the Biblical creation account wasn't the only creation theory held in ancient days. Many other cultures had their own creation stories. While it's not my avorite source, Wikipeda has a fine article tracing the history of creationism as far back as the 5th century BC. Some excerpts:
Early history
David Sedley, in his book Creationism and Its Critics in Antiquity,
traces creationist thought to the presocratic thinkers Anaxagoras and
Empedocles, in the 5th century BC.2 Sedley states that Anaxagoras
was recognized by Plato as "the first overt champion of a creative
cosmic intelligence. Anaxagoras theory was that the original state of
the world was a roughly even mixture of all opposites, and that it was
the effect of the action of nous (intelligence or mind) that led to
the partial separation of such opposites, hot from cold, land from
water, rarefied from dense.
and later...
170 – Theophilus of Antioch wrote in defense of creation beliefs and a
relatively young Earth:
"There are not myriads of myriads of years, even though Plato said
such a period had elapsed between the deluge and his own time, . . .
The world is not uncreated nor is there spontaneous production of
everything, as Pythagoras and the others have babbled; instead the
world is created and is providentially governed by the God who made
everything. And the whole period of time and the years can be
demonstrated to those who wish to learn the truth. . . . The total
number of years from the creation of the world is 5,695.29 ... If some
period has escaped our notice, says 50 or 100 or even 200 years, at
any rate it is not myriads, or thousands of years as it was for Plato
. . . and the rest of those who wrote falsehoods. It may be that we do
not know the exact total of all the years simply because the
additional months and days are not recorded in the sacred books."[this
quote needs a citation]
And as long as I've sunk to using Wikipeda, I may as well include their article to show the history of flood geology.
The great flood in the history of geology
Many early Christians, including Tertullian, Chrysostom and Augustine,
believed that fossils were the remains of animals that were killed and
buried during the brief duration of the Flood.[13] The geological
peculiarity in northern Europe where much is covered by layers of loam
and gravel as well as erratic boulders deposited hundreds of miles
from their original sources furthered acceptance of the idea. Early
geologists interpreted these features as the result of massive
flooding (in the mid 19th century geologists accepted that they had
been formed by ice age glaciations).[14] The global flood was
associated with massive geographical upheavals, with old continents
sinking and new ones rising, thus transforming ancient seabeds into
mountain tops.[15][16]
During the Age of Enlightenment, naturalists began proposing natural
causes for the miracles recounted in the Bible. Naturalistic
explanations for a global flood were posed by John Woodward, (1695),
and Woodward’s student William Whiston, (1696).[17]
Finally, since Christianity sprang from Judaism, it seems appropriate to address what early Jewish belief was.
Classical rabbinic teachings
The vast majority of classical Rabbis believed that God created the
world close to 6,000 years ago, and created Adam and Eve from clay.
This view is based on a chronology developed in a midrash, Seder
Olam[disambiguation needed], which was based on a literal reading of
the Book of Genesis. It is attributed to the Tanna Yose ben Halafta,
and covers history from the creation of the universe to the
construction of the Second Temple in Jerusalem. Although a literal
approach is not always used when interpreting the Torah, there is a
split over which parts are literal.