MYSQL TUTORIAL II
- This is a tutorial for MySQL database access through a
programming language.It covers the basics of MySQL programming
with C, Perl, PHP, Java or Python. After this tutorial, you
should be able to work with MySQL database using one of those
- Basic knowledge about database and MySQL. More
information about MySQL
- Basic knowledge about the programming language your want
- Basic knowledge about how to connect to a Linux Server
- Basic knowledge about Linux command: script,
- Log into the EECS Linux Server cycle1.eecs.ku.edu
a) You can log into cycle1 from a Linux machine by using
"ssh" command to securely shell to cycle1. For example:
[xli72@1005-11 ~]$ ssh -l < YourEECS
Last login: Tue Aug 26 17:20:54 2013 from 1005-11.eecs.ku.edu
b)You can log into cycle1 from a windows machine by using
SSH client for Windows. If you are using a EECS widows machine,
you can use PuTTY, which has been already installed on the
If you don't have a SSH client, you need download and
install one(It is required to log into EECS website by using your
EECS account before you can download)
- Write (and compile) a program to access MySQL database to
complete the following tasks:
You may download an example program from: Examples
of writing embeded SQL programs in C, Perl, PHP, Java and
Python and modify it following the instructions to
complete the above tasks. Before you modify the program, make
sure that the program can work by compiling and running it.
- Create a table named Users with the following columns:
userID, userName, userAddress, userPhone. The primary key of
the table is userID.
- Insert 4 records into the table Users. At least one of
the phone numbers starts with 785, the
area code of KS. Data of those records should be inputted
from standard input or being hard coded directly in your
- Select those users whose phone numbers start with 785
using MySQL LIKE comparison operator and
output your results to stand output. (You can get more
information about LIKE operator by searching "MySQL like
query" on Google)
- You should submit a Lab report including the following parts:
- A short description of your program.
The function of your program and how it works should be
clearly stated in the description.
- The source code of your program
- The log information of compiling
your program. You can skip this if your program doesn't
- The log information of running your
ALL YOUR MATERIALS SHOULD BE SUBMITTED AS A PART OF YOUR
HOMEWORK, WHICH MUST BE A SINGLE FILE.
- To output your source code of program to the standard
output, you can use Linux command : cat.
- To get the log information of compiling or running your
program, you can execute Linux Command: script to save your
interactive session to a file.
- If you have any further questions
regarding your MySQL account or MySQL, please feel free to
contact the instructor.