Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried

$> ssh root@ip "gunzip < [backupfile.sql.gz] | \
      mysql -u [uname] -p[pass] [dbname]"`

but get the error:

ERROR 1044 (42000) at line 42: Access denied for user '[uname]'@'%'
                               to database '[dbname]'

I could do

$> ssh root@ip "mysql -u [uname] -p[pass] [dbname] -e 'drop table [table]'"

So I guess it can't be a remote permission problem.

What is the correct command to do a remote restore of gz file to mysql via ssh then?

share|improve this question

The user you are using does not have the file privilege to read file on the server. Just grant file privilege to the user and you will be fine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.