How to Fix the mysqldump Got error 1449 The user specified as a definer root does not exist when using Lock Tables

Question

I get Following Error Whenever i’m trying to Backup a mysql Database using mysqldump command

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

But still I can login to mysql server using Same Username and Password . This is Only Happening When Trying to Dump a Database Using mysqldump command

How Can I Fix This Problem? Any Solution.

Answer

It Is look Like some Permission Issue, To Fix the Problem Log in to Mysql Console as root or any other privilege user (for an example in a debian based Linux system you can use debian-sys-maint user) and Enter Following Command

GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

Just Replace The 'password' with actual mysql root password