Database Reference
In-Depth Information
The Installation Packages
The MySQL andMariaDB packages come with several programs. Foremost is the server,
aDB. This daemon is the software that actually stores and maintains control over all of the
data in the databases. The
mysqld
daemon listens for requests on a particular port (3306, by
default) by which clients submit queries. The standard MySQL client program iscalled
simply
mysql
. With this text-based interface, a user can log in and execute SQL queries.
This client can also accept queries from text files containing queries, and thereby execute
them on behalf of the user or other software. However, most MySQL interaction is done by
programs using a variety of languages. The interfaces for Perl, PHP, and others are dis-
cussed in
Chapter16
.
A few wrapper scripts for
mysqld
come with the server installation. The
mysqld_safe
script
isthe most common way to start
mysqld
,because this script can restart the daemon if it
crashes. This helps ensure minimal downtime for database services. You don't need to
know the details of how all of this works if you're just starting to learn MySQL and Mari-
aDB, but it gives you a sense of how powerful and versatile this database system can be.
MySQL, and thereby MariaDB, also comes with a variety of utilities for managing the
server. The
mysqlaccess
toolcreates user accounts and sets their privileges. The
mysqlad-
min
utilitycan be used to manage the database server itself from the command line. This
kind of interaction with the server includes checking a server's status and usage, and shut-
ting down a server. The
mysqlshow
tool maybe used to examine a server's status, as well
as information about databases and tables. Some of these utilities require Perl, or Act-
ivePerl for Windows, to be installed on the server. See the
Perl site
to download and install
a copy of Perl on non-Windows systems, and the
ActivePerl site
to download and install a
copy of ActivePerl on Windows systems.
MySQL and MariaDB also come with a few utilities for importing and exporting data from
and to databases.The
mysqldump
utility is the most popular one for exporting data and
table structures to a plain-text file, known as a
dump
file. This can be used for backing up
data or for copying databases between servers. The
mysql
client can be used to import the
data back to MySQL from a dump file. These topics and utilities are explained in detail in
PartI
.
You can opt not to install the helper utilities. However, there's no cost for them and they're
not large files. So you may as well install anduse them.