Presentation is loading. Please wait.

Presentation is loading. Please wait.

MYSQL and WAMP On LocalHost

Similar presentations


Presentation on theme: "MYSQL and WAMP On LocalHost"— Presentation transcript:

1 MYSQL and WAMP On LocalHost
Creating a database MYSQL and WAMP On LocalHost

2 Open phpmyadmin Create a database

3 Add database name

4 Select the DB andCreate the table

5 Add the fields Click on structure and get ready to add these fields.
TID – Integer, make the INDEX PRIMARY, make it autoincrement. T_LASTNAME—char 15 T_FIRSTNAME—char 10 T_Room—char 5 Set the DB engine to InnoDB

6 Add the fields to the table

7 The fields—Remember to change DB engine to InnoDB

8 Display of the structure

9 Click on the DATABASE testDB Add the name student to create that table

10 Add fields to STUDENT table
SID – Integer, make the INDEX PRIMARY, make it autoincrement. S_LASTNAME—char 15 S_FIRSTNAME—char 10 S_Room—char 5 S_Advisor—INT, make it indexed. You need this to make the relation. Be sure you set the engine to InooDB

11 The student table structure

12 The final structure created

13 Add a connection We are going to create a link between the primary key TID in the teachers table and S_Advisor in the student table. You need to click on the student table. And you are going to click on the relation view. You will see the list of fields for the table. Go to the field S_Advisor. You are connect that field to the entries in the teacher table. You need to select the field teachers.TID and click on save.

14 The foreign key is in STUDENT. So open the student table structure.

15 The result from clicking on RELATION VIEW

16

17

18

19 Show the connection worked
Now we are going to add some records to the teachers table. Then we will add records to the student table. You will see when we try to enter records for the S_Advisor, we get a drop down list of which has the entries from the teachers table.

20 Click on teachers table and select insert

21 Add the data and click go

22

23 To see results, click on browse

24 Add a few student records. Notice the drop-down arrow for advisor

25 We will look at how to tie the id numbers to the entries later in the semester.
You can only add advisors from the list provided. See the results.

26 Student Table Records

27 Difference between downloaded mysql site and La Salle Sites

28 List of differences WAMP uses an Apache server. Your host is localhost. system uses IIS server. Your host is csc-srv1.lasalle.edu. It is remote.

29 Privileges On localhost, you are an administrator. You have all privileges, so you can create users and many databases. On csc-srv1.lasalle.edu, your privileges are limited. You are a user, so you need to login. You have a database you can view. It is NORTHWIND. You have a pre-defined database. The name is your login ID. You can only see your databases.

30 You can create many different databases on localhost.
You are limited to creating only one on csc-srv1.lasalle.edu. For either, you can export the database both the structure and the data via SQL.

31 You can move a lasalle database to your home by exporting it, saving the exported SQL and then inserting it into the localhost. Try exporting NORTHWIND from lasalle to your home database. You can use this to test the feature. If you destroy the NORTHWIND at home, you can always rebuild it by reloading the SQL.

32 LA SALLE MYSQL To get to the lasalle version of mysql, you need to type the following link into your browser You will get a login request. The ID is your portal ID. Your password is your student id.

33 Login Screen

34

35 Databases You have access to 3 databases here NORTHWIND
One with your login ID Information_schema

36

37 What can I do From here you can Browse NORTHWIND or INFORMATION_SCHEMA
Create tables and relations in yournameDB Add relations and records in yournameDB

38 Look at the differences
What is easily visible here? What is the engine used for the tables? In LOCALHOST In csc-srv1.lasalle.edu

39 mysqlworkbench This tool allows you to see pictures of your tables and connections. There is a link in the website for you to download the tool. It is free ware. There is a PDF file that tells you how to connect it to your lasalle mysqldatabase. Each server database is called an instance. Try getting the tool to connect.

40 This tool is useful for showing the relations in your databases.
You can also use the tool to build the database tables and connections. We will talk about that later this semester.

41 You should walk through this example and try to create these tables both on your localhost and in your database on the lasalle server. We will be working much more with this over the next few weeks.


Download ppt "MYSQL and WAMP On LocalHost"

Similar presentations


Ads by Google