Hi all - I’m a newbie to all of this. I know enough to be dangerous. Right now, I’m downloading a copy of my wordpress site so I can mess around with it locally without affecting anything live. I’m in the process of trying to download MAMP and mess with that, but one of the steps is to download the “database”. I read the instructions here: https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql
On the first step, “where” exactly does it put it on my “droplet”? I’m running it on Ubuntu. I’m not sure if I can ftp it out of my droplet. Any clarity would be appreciated.
Thanks!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
My god. Why does every single DigitalOcean documentation page, whether their own or in the “Community Forums”, provide instructions that just plain don’t work?
What’s the Username if it’s not “sammy”? What’s the password? How do I get those? I picked ones I wanted to use and it said “mysqldump: Got error: 1045: Access denied for user ‘sammy’@‘localhost’ (using password: YES) when trying to connect”.
Geez, I wish I could just get working instructions on how to do this. Why does DigitalOcean make everything so hard?
I’m getting a -Bash: mysqldump: command not found
Do i need to change my folder?
Hi @xMudrii,
Thanks so much for the detail! When you say “SSH into the droplet”, is that just using terminal to access the droplet?
Hi @sengerson,
What you need to do is backup of
wordpress
MySQL database, and put it anywhere you want on Droplet. After that, you need to download it to your local machine usingscp
orrsync
.First of all - SSH to your Droplet. Command we will use for backup is called
mysqldump
. It is taking “dump” of database in.sql
format, from which you can create database with same data on local machine. Execute following command:Change sammy with MySQL username which you want to use. If everything is successful it will create
wordpress.sql
in your home folder.Now exit SSH session.
First download file you created. You can use
scp
orrsync
. Note: Follow only forscp
or only forrsync
, basically it is same, but I’ll write both for reference. In case you want to usescp
:This command will download
wordpress.sql
from Droplets home directory to your current directory. Same could be done with rsync:I’m assuming you’re using MAMP on OS X, so steps are for it. This article on MAMP blog says how to login to MySQL on it, so I’m basing following steps on it.
First step is on local machine is to login on MySQL using steps from following link. If it is successful we will start with creating database for WordPress.
It will create database. Now we need to create user for it.
For wordpressuser and password make sure it is matching username/password as is it on your Droplet. Or if you want to change it, make sure you change it also in
wp-config.php
. If you want to change it, or verify current settings, go to your WordPress directory and open that file with any text editor. There you will find following lines:So it says what is your username and password for database, make sure it matches with above query.
Now let’s update MySQL privileges with this simple command:
And exit MySQL shell with
Now we need to extract backup we made earlier. Open
wordpress.sql
you downloaded from server with any text editor. On beginning of file (first line) add following line:Save it and exit editor. Now let’s extract it. If you used following command to login to bash:
Instead it you want to execute now:
Make sure you have
wordpress.sql
in current directory. :)After that, WordPress should be working on your local machine. I hope it is not late answer, anyways it can stay here for future. :)