I am trying to dump my local database using this command: ssh root@ "mysqldump -u root -p mcc | gzip -9" > dblocal.sql.gz. However I receive this error: Permission denied (publickey). I am using a ssh key to login into the server. Do I have to use another command to avoid the ssh issue? This is the sshd_conf file:

enter image description here

enter image description here

  • You haven't said what OS/release you are using (you tagged two desktops and a server?), however it's common to deny root logins via ssh (do you have keys setup; password only is rarer still). – guiverc Dec 6 '19 at 8:56
  • Yes I login via my ssh key – Hrisi Dec 6 '19 at 8:59
  • not with password – Hrisi Dec 6 '19 at 8:59
  • What OS/release – guiverc Dec 6 '19 at 8:59
  • WinSCP version 5.15.5, uses Ubuntu – Hrisi Dec 6 '19 at 9:08

If you are already logged into your server with WinSCP, do not try to login again (using ssh) from its Console window. Use mysqldump directly:

mysqldump -u root -p mcc | gzip -9 > dblocal.sql.gz
  • It worked but without the space after -p: -pmcc. After that I saw it is only 203 kb. Do you think this is ok because I think the database is much bigger? – Hrisi Dec 9 '19 at 7:55
  • Sorry, but I cannot answer that. That's too vague question. We do not know anything about your database. And it's a different question anyway. -- Though didn't consider that the dump file is compressed? – Martin Prikryl Dec 9 '19 at 8:04
  • It is ok, thanks! – Hrisi Dec 9 '19 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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