As a WordPress developer I find myself continuously installing, deleting and updating many WordPress installations on my local development environment. This is where WP-CLI comes handy. WP-CLI is a simple command line tool that helps you in managing WordPress installations and perform many WordPress related tasks like installing, updating, exporting and much more.
Installing WP-CLI is fairly easy, however when using MAMP on Mac OSX, a few additional steps need to be performed in order to get WP-CLI up and running.
For this tutorial I assume that you have already downloaded and installed WP-CLI. Once you have successfully installed it, you need to take a few extra steps to perform MySQL related tasks.
Start by creating a
.bash_profile file into your home folder
/Users/Alessandro (for example). Open the file with your favorite editor and add the following lines to it.
Save the file, and go back to your terminal. You now need to save your bash profile changes by
Use the source command to apply your changes or alternatively, logout and log back in with your mac osx account.
This is it. You can now perform MySQL related tasks such as installing and creating a database through WP-CLI without the need to use phpMyAdmin or any other tool. With WP-CLI these tasks can be easily done with a few commands.