Cheese wasn’t good enough for these rodents.

The city Health Department shut down Magnolia Bakery’s flagship West Village location because of an infestation of mice, authorities said yesterday.

The popular cupcake shop, which gained fame after it was featured on “Sex and the City,” was shuttered Thursday after mouse holes and droppings were found.

“It was closed because of a mouse infestation,” confirmed Health Department spokesman Sam Miller.

“I can’t believe I came all the way from Pittsburgh for a rat-cake! Too gross!” said Dave Harshbarger, 41, though no rats were actually found.

A company spokeswoman said the mice were confined to the basement.

“Because of the flooding [from Hurricane Sandy], a lot of mice have moved inward, and that was the issue that was found in the basement,” said the spokeswoman, Sara Gramling.

She added that the bakery hoped to reopen today.

“We have had exterminators in here for the past 24 hours,” said the shop’s general manager, Eric Larios, 30.

“I used to love their vanilla cupcakes with the chocolate sprinkles,” said Leslie Hamilton, 31, who lives around the corner.

“But I don’t know. Ugh, mouse droppings? There are a lot of sprinkles on those cupcakes.”