Forum Moderators: phranque

Message Too Old, No Replies

How to get files from /var/lib folder?

         

duckxtales

12:13 am on Feb 27, 2007 (gmt 0)

10+ Year Member



Hi,

I have access to my server and I want to download my mysql database files and use it on my local machine. Problem now is that I'm not sure how I can ftp in to that folder and copy it. I know I can copy it to another directory under /home/username and ftp into that, but whats the easier way of doing this?

thanks

phranque

3:03 am on Feb 27, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



are you saying when you "cd /some/new/directory/path" in ftp it fails?
for permission reasons?
you should have the same permissions for "username" in ftp as elsewhere.
(unless it is anonymous ftp)

duckxtales

12:01 am on Mar 5, 2007 (gmt 0)

10+ Year Member



basically i just want to FTP directly into: /var/lib/mysql

how can i do this?

phranque

9:05 am on Mar 5, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you start up your ftp client pointing to the remote server.
i assume it puts you in /home/username here.
type "cd /var/lib/mysql".
if you have read permission to access /var/lib/mysql on the remote host you shouldn't get an error here.
type "lcd /var/lib/mysql" (assuming the same directory path locally).
if you have read permission to access /var/lib/mysql on the local host you shouldn't get an error here.
type "put some.mysql.file.name".
if you have read permission to access /var/lib/mysql/some.mysql.file.name on the local host and write permission to access /var/lib/mysql or /var/lib/mysql/some.mysql.file.name if it already exists on the remote host you shouldn't get an error here.
if you get an error you can't figure out, please post it and perhaps we can help you.

rocknbil

9:22 am on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have access to my server and I want to download my mysql database files and use it on my local machine.

I think you are going about it the hard way. You probably won't have permissions to FTP to that directory, or change to that directory via FTP - and this is what you want. FTP is not secure, if *you* can do that, so can someone who sniffs your FTP login.

mysqldump creates a backup of your entire database:

mysqldump -h [database host] --user=[sql user name] --password=[sql user pass] [database name] > /full/path/to/your-backup-file.sql

If it's a localhost, you can skip -h [database host]. You can enter this manually or within a script. If this results in a blank file, you have an invalid parameter in the command, the password is wrong, host is wrong, something.

Download the file to your computer via FTP. Then on your local computer, launch mysql, from the mysql commmand prompt type

source c:\full\path\to\your-backup-file.sql

(in the mysql command prompt it will look like this)

mysql>source c:\full\path\to\your-backup-file.sql

It will recreate your entire database in a matter of seconds and input all records.