Class 8 Prep
Databases Part 2
Now you should have a good grasp on basic SQL syntax and commands, as well as an understanding of how relational databases work. In this lesson, we'll install MAMP and learn how to use a real database on your computer through phpMyAdmin. We'll also expand our knowledge of SQL by working through some additional exercises at w3schools.
|Do||Exercises||w3schools SQL Database||Do all the lessons under SQL Database from "SQL Create DB" through "SQL Hosting". Note that you will have already covered the lessons on Drop Table, Create Table, and Foreign Keys in the Class 7 Prep.|
|Do||Interactive Course||Khan Academy: Intro to SQL||Complete all the lessons in: Modifying databases with SQL. Some of this content will overlap with what you learned in the w3schools tutorial above; that's okay - the added explanations and practice should help. Note that the UI is not wonderful, and the syntax checker can be finicky. Make sure you remember to use ";" to end all of your statements.|
MAMP is a suite of tools useful for developers. The acronym MAMP stands for Mac / Apache / MySQL / PHP, and despite the first term, there is a version for Windows as well. While we won't use Apache and PHP directly, they'll provide us with an interface to work with our MySQL server, called phpMyAdmin.
If you use Linux, you should install, at a minimum, the MySQL 5.x package for your system. You might also install phpMyAdmin or another MySQL management application. For further help on LAMP installation (LAMP is the Linux equivalent of MAMP), check out How To Ubuntu or Bitnami.
Install MAMP for Windows
- Go to MAMP.info and download a 3.x version of the Windows installer for MAMP. Double click to install and allow it to make changes on the hard drive. Note: Recent 4.x versions of MAMP have had issues on some Windows installs. We highly recommend using a 3.x version at the current time.
- Close all other applications.
- Select English as the language.
- Uncheck the MAMP PRO box (do NOT download it).
- Accept the Terms/License.
- Keep the default destination of
- Keep the default option to let it create a shortcut.
- Keep the default option to let it create desktop icon.
- Click the "Install" button. (Install takes around five minutes.)
- Click "Finish".
- Open MAMP and go to Preferences..., then click the Ports tab and click the "Set MAMP ports to default" button. Click OK and then click "Quit".
- Reopen MAMP, ignore it if there is a message about the ports, and click Open start page.
- In your browser you should now be at
localhost:8888/MAMP/. Select the dropdown menu under Tools and click on phpMyAdmin.
- Enter the username: "root" and the password: "root" to login. Now you are on the main phpMyAdmin page that you will use for this lesson's studio.
Install MAMP for Mac
- Go to MAMP.info and download the Mac version of MAMP.
- Drag and drop the downloaded file in Finder from Downloads to Applications. Then double click it.
- Click "continue" on the Introduction, Read Me, and License prompt screens, and Agree to the terms.
- Click "continue" on the Destination Select screen--it will install onto the hard drive.
- Click "install" on the Installation Type screen.
- Click "close" when the install has completed.
- Note that it will install in the Applications folder. Go into Applications, double click on the MAMP folder, then double-click on the MAMP icon in that folder. Note that the installer will install both MAMP and MAMP PRO, but we'll only be using MAMP, not MAMP PRO.
- You'll get a "Warning" message. Be sure to uncheck the box next to "Check for MAMP PRO when starting MAMP" and then click the "Launch MAMP" button NOT the "Launch MAMP PRO" button.
- Go to Preferences -> Ports and click "Set MAMP ports to default" then click OK.
- Then go to Preferences -> PHP and select the Standard Version
7.0.15(you will need a php version older than
7.1.1for phpMyAdmin to work properly). Then click OK.
- Click Start Servers and it should automatically open a web page. If it does not, click Open WebStart page.
- In your browser you should be on the MAMP localhost webpage. Select the dropdown menu under Tools and click on phpMyAdmin. You may or may not be prompted to enter a username and password. If you are prompted, use the word "root" for both.
- Now you are on the phpMyAdmin page you will use for this lesson's studio.