The user specified as a definer does not exist when using LOCK TABLES

Encountered annoying MySQL problem when trying to dump database from a backup server.

MySQL kept complaining about
The user specified as a definer ('myuser'@'%') does not exist when using LOCK TABLES
when I ran mysqldump.

The database had been originally dumped from production server, then imported into a backup server. The production server and backup server have different sets of users. “myuser” only existed in production, not on backup. The problem was probably caused by some view that still referenced “myuser”.

A quick workaround was to create “myuser” on the backup server as well.