Вы находитесь на странице: 1из 45

8

MySQL

MySQL ?
MySQL
.
p SQL
.
p web PHP APACHE
p My-es-que-el
( My-Sequel)
p

MySQL AB
MySQL AB
p MySQL
p
p
p ,

MySQL
1981-83 :
MySQL
1983-84 : - MySQL
""

.
1989
:
data-warehousing (Analytikerna
/ Lentus).
1991-94 :
ISAM engine.
.
4

MySQL
1995
: SQL-engine (25
1995 -
).
1996 :
MySQL.
1996-2001 : 20
,
...
2001
:
CEO .
.
5

MySQL
2001 : 3.23.
- storage engine
SQL
- MyISAM.
- storage engines InnoDB/BerkeleyDB.
- .
2003 : 4.0.
- Query Cache.
- Full Text Search.
- Embedded library.
- .
. 2004 : 4.1.
-
- UTF8 + charsets collations
- OpenGIS
- Prepared statements +
-
- MySQL Cluster (main memory/shared nothing )
6

MySQL
p
p

p
p

5.0:
2005, 2005.
5.1:
2005,
2008.
5.4:
2009.
6.0:
.

26 2008 Sun Microsystems


MySQL AB $1 .

27 2010 Oracle Corporation Sun


Microsystems MySQL .
7

MySQL

p 100

p 6,000,000
p 35,000
p
SAP
p Yahoo!, NASA, Google
p
p

MySQL?
p
p
p
p
p
p
p
p
p


:
n
n

50 ,
8 TB
9

IBM, ORACLE and Microsoft


The top dogs
The enterprise/SMB market
Market Strength, Brand Equity, Track Record and Feature Variety

MySQL The underdog Disruptive technology, Commoditized Market


Performance, Reliability, Security, Performance

10

MySQL

GPL open source License

Client-Server model
Standalone server
FREE

Service Support, training and Consulting

11

?
p

MySQL Enterprise
n

MySQL Cluster
n

MySQL Embedded Database


n

MySQL,

OEM/ISV
,

MySQL community edition


12

MySQL Community vs. Enterprise

13

MySQL Enterprise
p

MySQL Enterprise Monitor


n

a "Virtual DBA Assistant" to enforce MySQL


recommended best practices

MySQL Enterprise Server


p MySQL Production Support
p

n
n

get your toughest technical questions


answered quickly
advise you on how to properly design and tune
your MySQL servers, schema, queries, and
replication set-up
14

MySQL Cluster
storage engine
:
-

-
-

15

:
-
-

:
- load-balancing
- high-availability
- backup

MASTER

MySQL Server

MySQL Server

SLAVE

Stores binary TX logs

MySQL Server
MySQL Server

SLAVE

SLAVE

16

Platinum

$4995/server/Year

Gold

$2995/server/Year

Silver

$1995/server/Year

Basic

$595/server/Year
17

MySQL ?
http://www.mysql.com/downloads/
p
p Download MySQL 5.0 Community Server GA
p Download MySQL Administrator
p Download MySQL Migration Toolkit
p Download MySQL Query Browser
p

18

server
p

Follow the screenshots

19

server

20

server

21

server

22

server

23

server

24

server

25

server

26

server
p
p

firewall,
TCP port 3306

, Administrator,
Migration Toolkit Query Brower


C:\Program Files\MySQL\MySQL Server
5.0\my.ini

server instance configuration wizard

27

MySQL administrator

28

Query browser

29

mysqld, mysql, mysqladmin, mysqldump


( C:\Program Files\MySQL\MySQL Server 5.0\bin)
p ?
p ?
p ?
p


30

MySQL
p


MySQL :

http://dev.mysql.com/doc/refman/5.0/en/string-types.html
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

10
:

Chapter 10. Data Types


http://dev.mysql.com/doc/refman/5.5/en/data-types.html

31

MySQL
p

INT
n

can contain values up to 2147483648


p

INT

INT(3)

REAL
n can contain values from-3.402823466E+38 to
-1.175494351E-38, 0 and 1.175494351E-38 to
3.402823466E+38

32

MySQL
p

DECIMAL[(M[,D])]
p

CHAR(length)
n

fixed character length, wastes diskspace


p

DECIMAL(5,2)

CHAR(10)

VARCHAR(length)
n

variable character length, economical to use


p

VARCHAR(10)

33

MySQL
p

DATE
n Y2K Compliant
n displays DATE values in 'YYYY-MM-DD'
format

TIME
n displays TIME values in 'HH:MM:SS' format

DATETIME
n displays DATETIME values in 'YYYY-MM-DD
HH:MM:SS' format

34

MySQL
INT
p DECIMAL (M,D)
p VARCHAR(length)
p DATE
p

35

36

ISAM
n
n
n
n
n

Indexed Sequential Access Method


Fastest table type in MySQL
Originally used in mSQL by TcX (the predecessor of MySQL AB)
Do not support transactions and foreign key
No longer supported after version 5.1

InnoDB
n
n
n

Purchased by MySQL later


Large data volume, heavy-load production system
Support transactions and foreign key

37

MySQL
p

:
n

Application layer ( )
,
.
MySQL.

:.NET, Java, C, C++, PHP, Python, Ruby, Tcl,
Eiffel, etc...

Logical Layer ( )
MySQL,
, ,
(, ...).

.

wit
s

Physical Layer ( )
,
MySQL.
, MySQL
API's.
,
: MyISAM, InnoDB, CSV, NDB Cluster, Falcon,
etc...

MySQL:

p

()
MySQL,
.

,
,

(SELECT)
.


,
.

,

p

MySQL Innodb
,
,
.
ACID:
n

Atomicity ()

,
.
Consistency ()
,
.
Isolation ()
,
.
Durability ()
,
.

MySQL:

p

MySQL
,
.

- ,
-.


storage engine

:
MyISAM

,
,

InnoDB

,
+

Memory

,
hash btree

Archive

CSV

CSV

storage engine!

42

..

p
p
p
p
p

43

MySQL

p


MySQL :

1.

MySQL.
,
.

2.

MySQL.
,
.
.

3.

( ).

4.


.
44


http://www.mysql.com/
p http://www.mysql.ru/docs/
p http://planet.mysql.com/
p http://dev.mysql.com/doc/
p

45

Оценить