ERROR in "MysqlDump" Access denied?

Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
When i try to run simple bash DB backup command on my paid shared hosting via SSH i get this error

mysqldump: Couldn't execute 'SHOW DATABASES': Access denied; you need (at least one of) the SHOW DATABASES privilege(s) for this operation (1227)
Tried adding skiplock then it errors same with access denied flush privileges etc, i had also tried without "--single-transaction" and "--force --lock-all-tables"

PHP:
mysqldump --user=${USER} --password=${PASS} --single-transaction --quick --force --lock-all-tables --all-databases | gzip --quiet > "${backup_dir}/${backup_date}.sql.gzip"
 
Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
I had also checked PhpMyAdmin privileges . No matter what switch i use or don't i get this error this
mysqldump: Couldn't execute 'SHOW DATABASES': Access denied; you need (at least one of) the SHOW DATABASES privilege(s) for this operation (1227)
i.imgur.com/7nYHXk4.png

- Please Attach Images to Your Posts -
 
Last edited by a moderator:
Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
I was able to reproduce the error, i found it. Whenever i use this switch "--all-databases" it will throw access denied. If i dont use this switch and specify hard-coded DB name then it works. Any solution for this? how to retrieve DB name onfly ?
 
Mar 3, 2016
11
0
1
Earth
cPanel Access Level
Website Owner
I feel my host doesn't allow that and its very pathetic ..

i tried
$ echo "show databases;" | mysql
$ echo "show databases;" | mysql -u [user with mysql access]
$ echo "show databases;" | mysql -p -u [user with mysql access]

But all shown privilege error, so tell me how in the world i find DB name so i can use that in mysqldump ??
ERROR 1045 (28000): Access denied for user
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
I was able to reproduce the error, i found it. Whenever i use this switch "--all-databases" it will throw access denied. If i dont use this switch and specify hard-coded DB name then it works. Any solution for this? how to retrieve DB name onfly ?
Hello :)

It makes sense that "--all-databases" does not work with a shared hosting plan because I believe it's designed to dump all MySQL databases on the server. Could you elaborate on your specific need? For instance, are you attempting to download a backup of your database, or do you require additional data?

Thank you.