Lab #11 CSCI 201 Title MySQL Installation Lecture Topics Emphasized Databases Introduction This lab will introduce you to MySQL. Before being able to run the DBMS, we will need to install it. There is another tool that helps us to visualize the database called MySQL Workbench that we will also install. By the end of this lab, you will have a working version of MySQL and be able to insert and select from a database you have created. If you are running OSX, go to page 10 to find your installation instructions. Description Part 1.1 Download and Installation in Windows Windows 7/8/8.1/10 Go to http://dev.mysql.com/downloads/windows/installer/ Click either the first or second download. It doesn t matter which. 1/23
You don t need to sign up or log in. Just say no thanks. THE INSTALLER WILL ASK YOU TO SAVE A TEMPORARY PASSWORD. SAY YES! Accept the license agreement. 2/23
Choose Developer Default. This will install everything we need and more. You may get a warning similar to this. Just make sure they aren t related to Java. 3/23
Press Execute and wait for everything to finish. 4/23
Press Next > Leave everything as is. 5/23
You do need to create a user account. Make the username and password ʹrootʹ. If you do not do this the next lab will be unnecessarily difficult. You will be using this username and password for all class SQL labs/projects. Yes, this is generally a bad idea in real life applications, but we will gloss over this for the sake of learning SQL. After this is done, press Next > 6/23
Press Execute, and wait for everything to finish. Press Next > 7/23
Enter the username and password. And check the connection. Press Next > Press Execute and wait for it to finish. 8/23
Press Next > All done! MySQL is installed. Go ahead and start MySQL Workbench. Go to page 16 to continue. 9/23
Part 1.2 Download and Installation in OSX Go to http://dev.mysql.com/downloads/mysql/ Select a download for your machine. Do not download the.tar file!!! Download the.dmg file (yes it is bigger!) Continue THE INSTALLER WILL ASK YOU TO SAVE A TEMPORARY PASSWORD. SAY YES! 10/23
Continue Select a destination, then install. 11/23
Close Now, start the MySQL server by going to System Properties. 12/23
Select MySql and this window will appear. Press Start MySQL Server. The server will then start. 13/23
Now, go to http://dev.mysql.com/downloads/workbench/ Download and Install. 14/23
Now, launch MySQLWorkbench. 15/23
Part 2 MySQL Workbench On Windows, you will see a single connection. For Mac, you won t have any connections yet. Press the plus button to make a new For Windows, Right click and select Edit Connection For Mac, press New. Set the connection name to something a bit more meaningful such as My201SQL. 16/23
Now double click the grey box to open the editor Enter your password you set earlier. 17/23
You will see the following page. Click the highlighted button to create a new schema. 18/23
Enter a name for the schema. Once you press Apply a new window will pop up. Press Apply. This will create the new schema. 19/23
Double click the schema to select it. Click the highlighted button to create a new table. Go ahead and name the table. Also insert two columns. 20/23
Name the columns name and created. The name column will correspond to the name of the resource. The created column will correspond to the number of that resource that has been created. Press Apply and you will see another window like before. Once again, hit Apply. This new table will be generated. Click the highlighted button to view the new table. 21/23
The table is empty. We can type values in manually, but we should have Java code do the work for us. 22/23
Part 3 Creating Tables Create a new table, and name it factoryresources. Look in the factory.txt file in your Factory project and duplicate the information into the factoryresources table in the mysql workbench. You donʹt have to write any Java code, just try to get used to using mysql and looking up instructions on how to do things on the internet. This doesnʹt mean that you will not be coding at all, you will need to write some SQL code. Try looking though the resource below, and pay close attention to the INSERT and SELECT statements. If you donʹt end up using these statements there are other ways to do this. http://www.w3schools.com/sql/ Hint: Once you have created a new table, there should be a window up top that allows you to enter and execute SQL code. You can run it by clicking the little lightning button. If you want default values to appear on the table, there will be one additional step to get an extra row to appear. Grading Criteria Labs are not graded based on any given criteria but are instead graded on effort and attendance. If you arrived to lab within the first 10 minutes and worked on it the for the entire duration of the lab, you will receive full credit regardless of whether you completed it. TAs will not grade labs until after at least half the lab period has elapsed. Use the lab time as an opportunity to more fully understand the course material and ask your TA questions. 23/23