mysqldump error: 1044: Access denied for user ... when using LOCK TABLES

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 command - how to dump (backup) a MySQL database

MySQL backup FAQ - How do I backup/dump a MySQL database schema?

Answer: Use the mysqldump database utility.

MySQL dump examples using the mysqldump utility

On a DOS/Windows pc with no name/password protection, you can dump a database named my_db with the following command, but don't do this just yet:

mysqldump my_db

Note that this gets you not only the database schema, but also the current data in the table.