*What is MySQL
MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by MySQL AB. MySQL AB is a commercial company, founded by the MySQL developers. It is a second generation Open Source company that unites Open Source values and methodology with a successful business model.
The MySQL Web site (See Fig.1-24) provides the latest information about MySQL software and MySQL AB.
MySQL is a database management system
A database is a structured collection of data. It may be anything from a simple shopping list to a picture gallery or the vast amounts of information in a corporate network. To add, access, and process data stored in a computer database, you need a database management system such as MySQL Server. Since computers are very good at handling large amounts of data, database management systems play a central role in computing, as standalone utilities, or as parts of other applications.
MySQL is a relational database management system A relational database stores data in separate tables rather than putting all the data in one big storeroom. This adds speed and flexibility. The SQL part of “MySQL” stands for “Structured
Query Language.” SQL is the most common standardized
language used to access databases and is defined by the ANSI/ISO SQL Standard. The SQL standard has been evolving since 1986 and several versions exist. In this manual, “SQL-92”
refers to the standard released in 1992, “SQL: 1999” refers to
standard released in 1999, and “SQL: 2003” refers to the current
version of the standard. We use the phrase “the SQL standard”
to mean the current version of the SQL Standard at any time.
MySQL software is Open Source
Open Source means that it is possible for anyone to use and modify the software. Anybody can download the MySQL software from the Internet and use it without paying anything. If
you wish, you may study the source code and change it to suit your needs. The MySQL software uses the GPL(GNU General Public License), to define what you may and may not do with the software in different situations. If you feel uncomfortable with the GPL or need to embed MySQL code into a commercial application, you can buy a commercially licensed version from us. See the MySQL Licensing Overview for more information.
The MySQL Database Server is very fast, reliable, and easy to use
If that is what you are looking for, you should give it a try. MySQL Server also has a practical set of features developed in close cooperation with our users. You can find a performance comparison of MySQL Server with other database managers on our benchmark page.
MySQL Server was originally developed to handle large databases much faster than existing solutions and has been successfully used in highly demanding production environments for several years. Although under constant development, MySQL Server today offers a rich and useful set of functions. Its connectivity, speed, and security make MySQL Server highly suited for accessing databases on the Internet.
MySQL Server works in client/server or embedded
The MySQL Databade Software is a client/server system that consists of a multi-threaded SQL server that supports different backends, several different client programs and libraries, administrative tools, and a wide range of application programming interfaces (APIs).
We also provide MySQL Server as an embedded
multi-threaded library that you can link into your application to get a smaller, faster, easier-to-manage standalone product.
A large amount of contributed MySQL software is
It is very likely that your favorite application or language supports the MySQL Database Server.
The official way to pronounce “MySQL” is “My Ess Que Ell”
(not “my sequel”), but we don’t mind if you pronounce it as “my
sequel” or in some other localized way.
The Main Features of MySQL
This section describes some of the important characteristics of the MySQL Database Software. In most respects, it applies to all versions of MySQL. For information about features as they are introduced into MySQL on a series-specific basis.
#Written in C and C++.
#Tested with a broad range of different compilers.
#Works on many different platforms.
#Uses GNU Automake, Autoconf, and Libtool for portability.
#The MySQL Server design is multi-layered with
#Fully multi-threaded using kernel threads. It can easily use multiple CPUs if they are available.
#Provides transactional and non-transactional storage engines.
#Uses very fast B-tree disk tables (MyISAM) with index compression.
#Relatively easy to add other storage engines. This is useful if you want to provide an SQL interface for an in-house database.
#A very fast thread-based memory allocation system.
#Very fast joins using an optimized one-sweep multi-join.
#In-memory hash tables, which are used as temporary tables.
#SQL functions are implemented using a highly optimized class library and should be as fast as possible. Usually there is no memory allocation at all after query initialization.
#The MySQL code is tested with Purify (a commercial memory leakage detector) as well as with Valgrind, a GPL tool.
#The server is available as a separate program for use in a client/server networked environment. It is also available as a library that can be embedded (linked) into standalone applications. Such applications can be used in isolation or in environments where no network is available.
Many data types: signed/unsigned integers 1,2,3,4,and 8 bytes long,FLOAT,DOUBLE,CHAR,VARCHAR,TEXT,BLOB,DATE
OpenGIS spatial types.
Fixed-length and variable-length records.
Statements and Functions
#Full operator and function supported in the SELECT list
and WHERE clause of queries.
last_name) Mysql>WELECT CONCAT(first_name,”,
; FROM citizen
; WHERE income/dependents>10000 AND age >30;
# Full support for SQL GROUP BY and ORDER BY clauses.
Support for group functions
#Support for LEFT OUTER JOIN and RIGHT OUTER JOIN with both standard SQL and ODBC syntax.
#Support for aliases on tables and columns as required by standard SQL.
#DELETE, INSERT, REPLACE, and UPDATE return the
number of rows that were changed (affected). It is possible to return the number of rows matched instead by setting a flag when connecting to the server.
#The MySQL-specific SHOW statement can be used to
retrieve information about databases. Storage engines, tables and indexes. MySQL 5.0 adds support for the
INFORMATION_SCHEMA database, implemented
according to standard SQL.
#The EXPLAIN statement can be used to determine how the optimizer resolves a query.
#Function names do not clash with table or column names. For example, ABS is a valid column name. The only
restriction is that for a function call, no spaces are allowed between the function name and the “(” that follows it.
You can refer to tables from different databases in the same statement.
A privilege and password system that is very flexible and
secure, and that allows host-based verification.
Passwords are secure because all password traffic is encrypted when you connect to a server.
Scalability and Limits:
Handles large databases. We use MySQL Server with databases that contain 50 million records. We also know of users who use MySQL Server with 60,000 tables and about 5,000,000,000 rows.
Up to 64 indexes per table are allowed (32 before MySQL 4.1.2). Each index may consist of 1 to 16 columns or parts of columns. The Maximum index width is 1000 bytes (767 for InnoDB); before MySQL 4.1.2, the limit is 5000 bytes. An index may use a prefix of a column for CHAR, VARCHAR,
BLOB, or TEXT column types.
Clients can connect to MySQL Server using several
Clients can connect using TCP/IP sockets on any platform.
On Windows systems in the NT family (NT, 2000, XP, 2003, or Vista), clients can connect using named pipes if the server is started with the—enable-named-pipe option. In
MySQL 4.1 and higher, Windows servers also support shared-mimory connections if started with the ——
shared-memory option. Clients can connect through shared memory by using the---protocol=memory option.
On UNLX systems,clients can connect using UNLX domain socket files.
MySQL client programs can be written in many languages. A client library written in C is available for clients written in C or C++, or for any language that provides C bindings.
APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tel are available, allowing MySQL clients to be written in many languages.
The Connector/ODBC(MyODBC) interface provides MySQL support for client programs that use ODBC(Open
Database Connectivity) connectons. For example, you can use MS Access to connect to your MySQL server. Clients can be run on Windows or UNIX. MyODBC source is available. All ODBC 2.5 functions are supported, as are many others.
The Connector/J interface provides MySQL support for Java client programs that use JDBC connections. Clients can be run on Windows or UNIX. Connector/J source is available.
MySQL Connector/NET enables developers to easily create. NET applications that require secure,
high-performance data connectivity with MySQL. It ipmplements the required ADO. NET interfaces and integrates into ADO. NET aware tools. Developers can build applications using their choice of. NET languages. MySQL Connector/NET is a fully managed ADO. NET driver written in 100% pure C#.
The server can provide error messages to clients in many languages.
Full support for several different character sets, including latinl(cp1252), german, big5,ujis, and more. For example,
the Scandinavian characters “a”, “a” and “o” are allowed in
table and column names. Unicode support is available as of MySQL 4.1.
All data is saved in the chosen character set.
Sorting and comparisons are done according to the chosen character set and collation (using latinl and Swedish
collation by default). It is possible to change this when the MySQL server is started. To see an example of very advanced sorting, look at the Czech sorting code. MySQL Server supports many different character sets that can be specified at compile time and runtime.
As of MySQL 4.1, the server time zone can be change dynamically, and individual clients can specify their own time zone (See Fig. 1-25).
Clients and Tool
MySQL AB provides several client and utility programs. These include both command-line programs such as mysqldump and mysqladump, and graphical programs such as MySQL Administrator and MySQL Query Browser.
MySQL Server has built-in support for SQL statements to check, optimize, and repair tables. These statements are available from the command line through the maysqlcheck client. MySQL also includes myisamchk, a very fast command-line utility for performing these operations on MyISAM tables.
MySQL programs can be invoked with the—help option
to obtain online assistance.