Sunday, October 13, 2013

Backing up MySQL database on restricted user account



Backing up MySQL database on restricted user account





I know that backing up databases is a job for a sysdamin. I know that I shouldn’t do that because I’m a stupid developer. I know that. I just couldn’t resist… And then I came across a strange error that sysadmin never encounters (you know… mysqldump -u root…). I couldn’t dump this db due to events error. So here is a quick solution for that.

The error:










1mysqldump: Couldn't execute 'show events': Access denied for user 'user'@'some-host' to database 'dbname' (1044)




Below lines are solving that. The magic option here is –skip-events

MyISAM:










1mysqldump -u usernam -p --skip-events --databases dbname > dbname_dump.sql




InnoDB:










1mysqldump -u usernam -p --skip-events --single-transaction --databases dbname > dbname_dump.sql




No comments:

Post a Comment