2. Supplement on MySQL
• http://cs.armstrong.edu/liang/intro7e/suppl
ement/Supplement4bMySQL.pdf
3. MySQL Download and Install
• http://dev.mysql.com/downloads/mysql/5.4.htm
• When you install the software, you can set
the root password.
4. Starting and Stopping MySQL Server
• Starting and stopping the server
– See Item 1 in supplement
• Login
– mysql –u root –p
– Type your password
• Create an ordinary user
– See Item 3 in supplement to create a user with name
“scott” and password “tiger”
5. Databases in MySQL
• show databases;
• use test;
• create database javabook;
• use javabook;
7. Load from a File
• Put the above commands in a file, e.g.,
test.sql and put in D:booktest.sql.
• Then in MySQL command line window,
type: source D:booktest.sql
9. Set MySQL JDBC Driver
• An easy way
– Copy slidebookmysqljdbc.jar to C:Program
FilesJavajre1.6.0_03libext
– Try to run the program
• An alternative way
– In command line window
– set classpath=%classpath
%;c:slidebookmysqljdbc.jar;
– cd slidebook
– java FindGrade
10. Set MySQL JDBC Driver
• An easy way
– Copy slidebookmysqljdbc.jar to C:Program
FilesJavajre1.6.0_03libext
– Try to run the program
• An alternative way
– In command line window
– set classpath=%classpath
%;c:slidebookmysqljdbc.jar;
– cd slidebook
– java FindGrade