By Alvin Alexander. Last updated: June 4, 2016
A quick note on a MySQL error: I got the following error when using mysqldump
this past weekend:
mysqldump: Got error: 1044: Access denied for user 'USER'@'localhost' to database 'DBNAME' when using LOCK TABLES
The solution to this problem/error was to use one of these mysqldump
commands:
mysqldump --opt --lock-tables=false -u USER -p DBNAME > dump.sql mysqldump --opt --single-transaction -u USER -p DBNAME > dump.sql
I normally don’t use the --lock-tables
or --single-transaction
options when using mysqldump
, but when you encounter this error, this is the workaround.
(Honestly I can’t remember what I did differently when I created this MySQL database, and didn’t look into the problem more than finding this solution, as I was moving the database from one server to another.)