2013-02-13

MySQL Dump: Access Denied

I needed an SQL dump of my Global GoldSrc Database to continue work locally. Un-/Fortunately, the server owner and sysadmin is very concerned about server security, so I was unable to just dump the database with this:
mysqldump -p -u osaft osaft_gtfcdb4 > osaft_gtfcdb4-20130213.sql
The server wouldn't let me because of insufficient access.
mysqldump: Got error: 1044: Access denied for user 'osaft'@'localhost' to database 'osaft_gtfcdb4' when using LOCK TABLES
Fortunately, there's a simple solution that should work like a charm: --single-transaction.
mysqldump -p -u osaft osaft_gtfcdb4 --single-transaction > osaft_gtfcdb4-20130213.sql
Then just bzip it (or not) and you're done!
tar -cvjf osaft_gtfcdb4-20130213.sql.bz2 osaft_gtfcdb4-20130213.sql