How to install, start and test MAMP on Mac OSX
MAMP is a free distribution package that makes it easy to install Apache Web Server, PHP, and MySQL on a Mac.
Installing MAMP on a Mac
- Download the latest version of MAMP.
- Open the downloaded file (e.g., MAMP_MAMP_PRO_4.5.pkg) and click through the installation wizard.
- Close the installation wizard.
Running MAMP on OSX
To run MAMP...
- Navigate to Applications/MAMP in Finder and open MAMP.app
- Click Start Servers:
- The following page should open in your browser:
- Download the class files
- After downloading the class files, create a folder in htdocs named "Webucator" and extract your class files in that folder.
- To test that your setup so far is correct, open your browser and navigate to http://localhost:8888/Webucator/ClassFiles/. You should get a listing like this:
- Click PHPBasics, then click Demos, and then HelloWorld.php. You should get a page that looks like this:
Setting the MySQL Password
The PHP files use "pwdpwd" for the MySQL root password, while the default password used in MAMP is "root". In your browser, navigate to http://localhost:8888/phpmyadmin/.
Note: It is important to do these steps in the order specified.
- Click the mysql database on the left.
- Click the SQL tab at the top.
- Enter the following in the textbox under Run SQL query/queries on database mysql:
- Click Go.
- You also need to update the password in /Applications/MAMP/bin/phpMyAdmin/config.inc.php. Open the file in your editor (e.g., Visual Studio Code) and change the password setting as show below to 'pwdpwd'.
Installing Northwind Database using MAMP
We use the Northwind database in this class.
- To install the Northwind database used in class, open your browser and navigate to http://localhost:8888/phpmyadmin.
- If it asks you to login, the username is "root" and the password is "pwdpwd".
- On that page, click on the Import link under the Localhost heading. After, it should say "Importing into the current server".
- Browse to the Northwind-MySQL.sql file in your class files (/Applications/MAMP/htdocs/Webucator/ClassFiles/Northwind-MySQL.sql).
- Click the Go button on the bottom left of the page.
- You should get a Success message and Northwind should be added to your list of Databases.
One Final Test
Point your browser to http://localhost:8888/Webucator/ClassFiles/ManagingData/Demos/EmployeeReport.php. If you see a page like this, you're all set:
And that's it
Happy Mac MAMPing!
Recommended Code Editor
Visual Studio Code (Download, Install, and Set up VS Code)
While you may use a different editor or IDE, Visual Studio Code is an excellent IDE to learn to code on. It provides a nice balance of power and simplicity and it is available on Windows and Mac.