web analytics

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

I came across this error while taking the database dump of a database. The database was originally created in another server and transferred to my server after long. When I tried to take a database dump as a part of my backup script, I came across this error.

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

Basically this error is caused by a definer which was created in the previous server but is not present in the new server. The easiest way to get past this error is to go to the original dump file and search for ‘definer’ in it.

/*!50013 DEFINER=`user`@`%` SQL SECURITY DEFINER */

If found, modify it to reflect the root user or database user in your new server.

/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */

I also removed the database which was already restored and recreated it, just to be sure everything starts afresh.

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>