Issue with mysqldump
Closed this issue · 2 comments
Hi, not sure if this is the right place for this. But I am having issues with the mysqldump configuration.
My database.yaml looks like the following
production:
adapter: mysql
encoding: utf8
reconnect: false
database: jtushman_tr_prod
pool: 5
username: jtushman_tr_prod
password: secret
host: 127.0.0.1
and my safe configuration looks like:
safe do
local :path => "/home/jtushman/backups/:kind/:id"
s3 do
key "my_key"
secret "my_secret"
bucket "backup.cairn.planner"
path ":kind/:id"
end
keep do
local 20
s3 100
end
mysqldump do
options "-ceKq --single-transaction --create-options"
user "jtushman_tr_prod"
password "secret"
host "127.0.0.1"
database :jtushman_tr_prod
end
end
When I run astrails-safe --verbose backup_db.rb
I get:
command: mysqldump --defaults-extra-file=/tmp/d20100106-14511-ysnqsz/mysqldump.14511.0 -ceKq --single-transaction --create-options tushman_tr_prod|gzip
mysqldump: Got error: 1044: Access denied for user 'jtushman_tr_prod'@'localhost' to database 'tushman_tr_prod' when selecting the database
Any ideas? What is wierd to me is the appending of @'localhost' to the user property.
Thanks!
MySQL always checks your permissions as user@host. since you are running it locally host == "localhost", or "127.0.0.1", or "your local hostname". It will check all variants. if none is permitted you get the error message.
As I wrote in a message reply before, it seems you have a typo in the database name.
the db in database.yml is jtushman_tr_prod and its tushman_tr_prod in the safe configuration (w/o the leading 'j')
let me know if this helps :)
That did the trick -- thanks!