Myers, who provided the voice of the ogre Shrek in the animated film series - which he played with a Scottish accent - said he hoped Scotland would "remain part of Britain".
Interviewed on BBC Radio 4's Today programme, he 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."