HTML and CSS Reference
What Role Does It Play?
MySQL will play the role of our app's memory. It will remember details about various rooms and questions, and have
them ready should they be needed in the future.
How Does It Work?
MySQL is installed on the server and works by creating a database, tables within the database, and rows within the tables.
Each row is a particular piece of data. For instance, if the table were called rooms , each row would contain a
room's information such as its name, unique identifier, and other related data.
MysQl is also covered in the aforementioned PHP for Absolute Beginners .
eXerCISe 2-5: FUN WIth MYSQL
Because integrating MysQl with our htMl markup would require a little too much setup, let's get geeky and
play with MysQl on the command line instead. You will, of course, need MysQl installed and configured on your
system. open up a terminal and connect to MysQl replacing your_username with your MysQl username:
mysql -uyour_username -p
You should be prompted for your password and then you'll be connected to your MysQl server. You can also use
a desktop client or phpMyadmin for this exercise—on Mac we recommend sequelpro, 9 and on Windows we've
heard good things about Navicat. 10
once you're connected to the server, create a database to play with and ensure things are working as expected.
let's call it awesome_test_db :
CREATE DATABASE awesome_test_db;
this should give you the following output:
Query OK, 1 row affected (0.00 sec)
Now let's select the database we will execute queries against:
this should tell you that the database was changed, which means we can now create a table:
CREATE TABLE awesome_things (
id INT PRIMARY KEY AUTO_INCREMENT,