mysqldump: Got error: 1449: The user specified as a definer ('user'@'%') does not exist when using LOCK TABLES

报错:
一个库用mysqldump -u -p --opt --force -e --max_allowed_packet= --net_buffer_length= --databases备份时报错如下:mysqldump: Got error: 1449: The user specified as a definer ('user'@'%') does not exist when using LOCK TABLES
解决:在网上查找别人的解决方法,大意是说数据库是从别的实例复制过来的,而复制时记录了原实例的用户,但是目前实例上并没有该用户,所以导致报错,我这个库确实是从别的实例复制过来的,网上的解决方法比较复杂,后面搜到一个英文网站的解决方法https://help.directadmin.com/item.php?id=453,在备份时加上--single-transaction参数即可。

原文地址:https://www.cnblogs.com/godfather007/p/10352364.html