Forum Moderators: phranque
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
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.