Download Ray Williams` slides

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft SQL Server wikipedia , lookup

IMDb wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Oracle Database wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Ingres (database) wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Relational model wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Introduction to MySQL
MySQL Overview
by
Ray Williams
CS 320/565 Marymount University
MySQL Overview
¢
MySQl is an Open Source Relational Database
¢
MySQL was created by MySQL AB in Sweden
by:
"
David Axmark
"
Allan Larsson
"
Michael "Monty" Wiedenus
The "Official" Site is http://www.mysql.com
¢
"
C
o
Note there is a current controversy where Progress Software
and NuSphere Corporation have set up another site
http://www.mysql.org in violation of the MySQL Copyright
MySQL Platforms
MySQL is available on a variety of platforms
¢
"
Linux
"
FreedBSD and NetBSD
"
Solaris
"
SCO Unix
"
Win32
"
WindowsNT
"
OS/2
MySQL Features
¢ Multithreaded
¢ ANSI SQL-92 Compliant
¢ Online Help
¢ Portability
¢ Many Application Programming Interfaces APIs
"
Perl
"
TCL
"
Python
"
Java (JDBC
"
ODBC
"
C++
MySQL Architecture
¢
As a database MySQL is a series of
structured files that are organized in a highly
efficient manner.
¢
By default the mysql database is created with
the host, user and database privileges.
Table
Table
Row
Column
Table
MySQL Files and Directories
¢ Directories
"
Support-files - files to aid in installing and configuring
"
Bin - MySQL commands
"
Data - Database data files
"
Include - All C header files
"
Tests - Perl scripts to test MySQL
"
Lib - Library files used in C++ API
"
Scripts - Install scripts for MySQL
"
Share - Error logs and messages
"
Mysql-bench - Home of crashMe tool
Files
"
"
ChageLog, INSTALL-BINARY, PUBLIC, README, manual.*
(txt, htm)
Starting & Stopping MySQL
bin/safe_mysqld &
¢
"
Starts the MySQL daemon (server) under Unix/Linux
mysqld.exe
¢
"
Starts the MySQL server under Windows
bin/mysqladmin -p ping
¢
"
Prompt for password (-p) and verify server daemon is
running.
bin/mysqladmin -p shutdown
¢
"
Prompt for password and shutdown server
Using MySQl
¢ To get into the command line:
"
bin/mysql -p
¢ To view installed databases
"
SHOW databases;
¢ To select a database
"
USE mysql;
¢ To view tables
"
SHOW TABLES FROM mysql;
¢ To view columns in a table
"
SHOW COLUMNS FROM user;
"
DESC user;
or
Using MySQL (cont.)
¢ To create a new database
"
CREATE DATABASE sample_db;
or
"
bin/mysqladmin -p CREATE sample_db;
¢ To delete a database
"
DROP DATABASE sample_db;
"
bin/mysqladmin -p DROP sample_db;
¢ To add a new user
"
INSERT INTO user VALUES('localhost',
'new_user',password('password'), 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y','Y','Y','Y','Y');
Using MySQl (cont.)
¢ INSERT INTO user VALUES('localhost',
'new_user',password('password'), 'Y', 'Y', 'Y', 'Y', 'Y',
'Y', 'Y', 'Y', 'Y', 'Y','Y','Y','Y','Y');
A Quick Run Thru MySQL
¢ CREATE DATABASE temp;
¢ USE DATABASE temp;
¢ CREATE TABLE test_table (Test_ID INT NOT NULL
PRIMARY KEY AUTO_INCREMENT, Test_Name
VARCHAR(30), Test_Date DATETIME, Test_Giver
VARCHAR(30));
¢ INSERT INTO test_table(Test_ID, Test_Name, Test_Date,
Test_Giver) VALUES (NULL,'Test','2001-10-02','Beryl');
¢ SELECT * FROM test_table;