MySql Notes - Florida State University



MySql Notes

COP 4710 – Fall 2006

(Updated 9/14/06)

- A very good tutorial on databases and MySql resides within the chapters posted here (caution: 10 MB file).

- A very good resource for MySql 4.x (we will eventually use 5.x) is here:



This is most helpful for understanding what the SQL syntax is for MySql (as it differs slightly from the most up to date standards presented to us in the textbook).

- You will be accessing your MySql database using your CS account.

- You will need to have SSH capabilities. You can do this from any computer lab on campus. We will discuss this using SSH Secure Shell. In order to obtain this software for your private use at home, you can goto:



- Once you have opened SSH Secure Shell, type “linprog.cs.fsu.edu” as your host name, your CS username as your username and leave the other two fields alone. Then hit (click on) “connect.” Type your password how many ever times it tells you, hitting “OK” after each time. If you have problems logging onto linprog then try explicitly connecting to linprog2.cs.fsu.edu. If you have further problems, then try using websrv2.cs.fsu.edu. If still you have problems, then try using another server (though the chances of success are unlikely). Any further problems, contact Michael.

- Once logged into an appropriate server (linprog), you can begin using MySql. We will all be sharing the same space on dbsrv.cs.fsu.edu and you will create all tables within the database that resides there. We will all use the username “cop4710” with the password being “cop4710pwd”. The database name is “cop4710db”.. What did you say? What happens if more than one of us is logged into the database and are modifying the same tables? You can only imagine...

- In order to start MySql type the following at the shell prompt and hit :

mysql –h dbsrv.cs.fsu.edu –p –u cop4710 cop4710db

At the prompt, enter the password (mentioned above).

- As demonstrated in the MySql book, you can run a script full of MySql statements. If your script file is named ‘statements.sql’ then do the following at the linprog shell prompt:

mysql –h dbsrv.cs.fsu.edu –p –u cop4710 cop4710db < statements.sql

After prompting you for your password, the statements will be ran on the database and you will be returned to the linprog shell prompt.

- We will not be creating new types or domains in MySql, instead we will just use ‘enum’.

- You cannot run a ’CREATE TABLE’ statement in MySql if the table already exists. You must first ‘DROP’ the table. Furthermore, you cannot drop a table that has not been created. *If a script contains an SQL statement that fails then the rest of the script will not run and MySql will abort.

- Note: You can specify all commands and types in lowercase (i.e. ‘DROP’ = ‘drop’, ‘INT’ = ‘int’).

- Note: Depending on how you store phone numbers, it is not possible to store every 10 digit phone number with ‘INT UNSIGNED’ so you should use ‘BIGINT(10) UNSIGNED’.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download