Flylib.com

Books Software

 
 
 

MySQL Tutorial - page 35


Summary

  • The most important directories in your MySQL installation are bin (executable programs), data (database data), and docs (documentation).

  • The two programs you will use the most are mysqld, the MySQL server, and mysql, the command-line client.

  • You have a choice of several user interfaces/client programs. We discussed mysql (command-line), MySQLCC (GUI), and phpMyAdmin (Web-based).

  • The mysql command-line program has many useful command-line switches and options. We have discussed -u (to specify username), -p (to log in with a password), -h (to specify the host), and --i-am-a- dummy (for damage-control mode).

  • When logged in, you can use SHOW DATABASES or SHOW TABLES to get a list of what is in the system and DESCRIBE tablename to get information about a particular table.

  • You can log out with \q .

  • You can terminate commands with ; or \g to send them to the server for execution.

  • You can execute a file of commands from inside the client with source filename and from outside the client by using file redirection.


Quiz

1:

You would find the MySQL server program in

  1. the docs or Docs directory

  2. the lib directory

  3. the scripts directory

  4. the bin directory

2:

You would find the MySQL documentation in

  1. the docs or Docs directory

  2. the lib directory

  3. the scripts directory

  4. the bin directory

3:

You would find mysqlhotcopy in

  1. the docs or Docs directory

  2. the lib directory

  3. the scripts directory

  4. the bin directory

4:

Commands in the MySQL monitor

  1. should be terminated with a semicolon

  2. should be terminated with \g

  3. either a) or b)

  4. none of the above

5:

The --i-am-a- dummy option to the mysql executable

  1. means what it says

  2. prevents me from doing too much damage while learning SQL

  3. prevents me from doing anything at all other than logging in and out

  4. none of the above



Exercises

Q1:

Download and install a graphical or Web-based user interface such as MySQLCC. Work out how to log in and get a list of available databases using the client program you have chosen .



Answers

Quiz

A1:

d

A2:

a

A3:

c

A4:

c

A5:

b



Next

In Chapter 3, "Database Design Crash Course," we will look at general database concepts, terminology, and design principles including normalization. If you are not new to databases but are new to MySQL, you can skim this chapter.


Part II: Designing and Creating Databases with MySQL

 

3 Database Design Crash Course

 

4 Creating Databases, Tables, and Indexes


Chapter 3. Database Design Crash Course

In this chapter we will review the basic principles of database design and normalization. A well-designed database minimizes redundancy without losing any data. That is, we aim to use the least amount of storage space for our database while still maintaining all links between data.

We will cover the following:

  • Database concepts and terminology

  • Database design principles

  • Normalization and the normal forms

  • Database design exercises