I was trying to export the database from MAMP with:
wp db export
But it kept saying command not found: wp. Long story short, that opened a can of worms that lasted about a day until I re-installed homebrew and then I was able to install PHP and WP-CLI.
To install Homebrew, you can use the following command. See their website here for further instructions.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After that, you can install PHP with the following command. You can also see the official PHP website here for further instructions.
brew install php
brew install wp-cli
You will also need to install MySQL with the following command:
brew install mysql
Be sure to be in the right directory, read Export / Import Large Database from MAMP using Terminal to see the right directory you need to be in. Which I’ll just add below:
Here’s the command to run to export the database:
./mysqldump -u dbusername -p dbname > filename.txt
It will prompt for the database password, it’s usually “root“
To move the file to another direcotry:
mv filename destinationfolder
In my case, I usually move the file to my desktop so it’s easier to drag in FTP.
To copy the file over to another folder:
cp -rf filename destinationfolder
is where all your images live. The database only holds the URLs of the images. So if you get this error:
It’s because you need to make sure all the images are in the uploads folder.
To be continued…
If you are not in the right Mamp folder where the database lives, you will get the following error. Which is very misleading because it has nothing to do with the password but the directory you’re in.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
No matter what password I type, it says I tried the password “YES” and if I don’t type any password, it says I typed the password “NO”
But I also get this error when trying:
After installing mysql
Have any questions or comments? Write them below!