I have recently messed up my debian server and I have only sftp access for my files. I rescue almost everything except of my database.

I have no longer direct ssh access, other than in rescue mode, which I cant use mysqldump etc.

Is there any way to backup my database from sftp? I copied and pasted the directory /var/lib/mysql/db to my new server. phpMyAdmin lists the tables but when you click on the it says that they do not exist. how to get my database back if the server is no longer accessible via terminal?

  • did you try using scp or rsync to backup mysql while in rescue mode? as long as mysql is not running, you can make a good copy of /var/lib/mysql with either of them. rsync is probably better because you can restart it from where it left off if the copying process dies for any reason (network failure, remote server crashed again, etc) before completion. PS: now you know the value of making regular backups (incl. offsite copies) before you need them.
    – cas
    Mar 19, 2016 at 2:14

1 Answer 1


I also had to restore the files all the database directories (not phpmyadmin or any other folder in there), ibdata1, ib_logfile1, ib_logfile0 while mysql server is stopped. Give them chown -R mysql:mysql * permissions and then restart mysql server. Everything was back on my new server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .