Myers, who provided the voice of the ogre Shrek in the animated film series and is also known for his lead roles in the Austin Powers and Wayne's World films - which he played with a Scottish accent - said he hoped Scotland would "remain part of Britain".
Interviewed on BBC Radio 4's Today programme, Myers was initially reluctant to express a view on the issue. But, pressed on what Shrek would say, he replied in the voice of the character: "Shrek wants what the will of the Scottish people want."
He then added in his own accent: "I love Scotland. I hope they remain part of Britain - and if they don't, I still love them."
Other celebrities who have urged Scots to stay in the UK - such as David Bowie and JK Rowling - have found themselves the target of online abuse from pro-independence supporters.
A spokesman for the pro-UK Better Together campaign said: "It's no surprise Mike Myers doesn't support separation. He knows a fairytale when he sees one."
Asked whether David Cameron welcomed Shrek's opposition to Scottish separation, a senior Downing Street source said: "The Prime Minister welcomes all support for the United Kingdom."
A spokesman for the pro-independence Yes Scotland campaign said: "As Mike Myers said, he can't answer for Shrek - the cuddly ogre wants whatever the will of the Scottish people is, and we plan to make the No campaign green with envy by achieving a Yes vote in September.
"Everybody, including Mike Myers, is entitled to his or her view about Scotland's future - and of course Elaine C Smith, Alan Cumming, Alex Norton, Lou Hickey, Brian Cox, Ken Stott, and Sean Connery are just some of those supporting a Yes vote."