Pages

Thursday, 11 September 2014

MYSQL: mysqldump error

I wanted to take a backup of the database using the mysqldump command and got the following error:

mysqldump: Got error: 1044: Access denied for user root'@'localhost' to database 'information_schema' when using LOCK TABLES 

It might be the possibility that because I was taking the backup from a remote server, I did not have the LOCK TABLES permissions. mysqldump locks the tables before taking the dump of the database.

A quick solution to this would be to pass the –single-transaction option to mysqldump:

$ mysqldump –single-transaction -u user -p database_name > backup_file.sql

Another solution would be to grant LOCK TABLES to the user you are using to take the mysqldump. But if you do not have grant rights its good to use --single-transaction.

NOTE: There might be some cases where --single-transaction might fail. In that case use -single-transaction [use single dash (-) instead of a double dash (--)].

No comments:

Post a Comment