Sunteți pe pagina 1din 57

1Z0-873 MySQL DBA Exam - Part I

Number: 1Z0-873
Passing Score: 800
Time Limit: 120 min
File Version: 2.0

http://www.gratisexam.com/

MySQL 5 Database Administrator Certified


Professional Exam, Part I
Exam Code: 1Z0-873

Unless another source is given, solution comments are quotes from: MySQL 5 Certification Study Guide By
Paul DuBois, Stefan Hinz, Carsten Pedersen (Pub Date: August 24, 2005)

In fact, virtually all correct answers are a paraphrase or even a quote of a statement made somewhere
in the Certification Study Guide.

Exam Topics

Section 1: MySQL Architecture (10%)


Client/Server Overview
Communication Protocols
The SQL Parser and Storage Engine Tiers
How MySQL Uses Disk Space
How MySQL Uses Memory
Section 2: Starting, Stopping, and Configuring MySQL (20%)
Types of MySQL Distributions
Starting and Stopping MySQL Server on Windows
Starting and Stopping MySQL Server on Unix
Runtime MySQL Configuration
Log and Status Files
Loading Time Zone Tables
Security-Related Configuration
Setting the Default SQL Mode
Upgrading MySQL
Section 3: Client Programs for DBA Work (5%)
Overview of Administrative Clients
mysql
mysqladmin
mysqlimport
mysqldump
Client Program Limitations
Section 4: Character Set Support (5%)
Performance Issues
Choosing Data Types for Character Columns
Section 5: Locking (10%)
Locking Concepts
Explicit Table Locking
Advisory Locking
Section 6: Storage Engines (20%)
MySQL Storage Engines
The MyISAM Engine
The MERGE Engine
The InnoDB Engine
The MEMORY Engine
The FEDERATED Engine
The Cluster Storage Engine
Other Storage Engines
Section 7: Data (Table) Maintenance (10%)
Types of Table Maintenance Operations
SQL Statements for Table Maintenance
Client and Utility Programs for Table Maintenance
Repairing InnoDB Tables
Enabling MyISAM Auto-Repair
Section 8: The INFORMATION_SCHEMA Database (5%)
INFORMATION_SCHEMA Access Syntax
INFORMATION_SCHEMA Versus SHOW
Limitations of INFORMATION_SCHEMA
Section 9: Data Backup and Recovery Methods (15%)
Introduction
Binary Versus Textual Backups
Making Binary Backups
Making Text Backups
Backing Up Log and Status Files
Replication as an Aid to Backup
MySQL Cluster as Disaster Prevention
Data Recovery
Exam A

QUESTION 1
Which one of the following statements can be used to start MySQL 5.0 manually from the command line on
windows?

A. C:\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin -u root start


B. C:\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld
C. C:\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql_start

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:

QUESTION 2
Another user has issued LOCK TABLES pets READ You can...

A. Update table pets


B. SELECT from table pets
C. UPDATE and SELECT from table pets
D. None of the above

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:

QUESTION 3
Which of the following statements are true for locks established by the InnoDB storage engine?

A. It sometimes escalates locks to page level.


B. It sometimes escalates locks to table level.
C. It sometimes escalates locks to page or table level.
D. It never escalates locks to page or table level.

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
29.4.4.
During the course of a transaction, InnoDB may acquire row locks as it discovers them to be necessary.
However, it never escalates a lock (for example, by converting it to a page lock or table lock). This keeps
lock contention to a minimum and improves concurrency.

QUESTION 4
Which of the following is true for how the InnoDB storage engine uses diskspace?

A. It stores its data, index and undo information all in its own tablespace.
B. It stores its data in .MYD files, in the respective database directory, and its index and undo information in its
own tablespace.
C. It stores its data and index in .MYD and .MYI files, in the respective database directory, and undo
information in its own tablespace.
D. It stores its data, index and undo information in .MYD and .MYI files, in the respective database directory.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
29.2. The MyISAM Engine
On disk, MySQL represents each MyISAM table using three files: a format file that stores the definition of the
table structure, a data file that stores the contents of table rows, and an index file that stores any indexes on the
table. These files are distinguished from one another by their suffixes. For example, the format, data, and index
files for a table named mytable are called mytable.frm, mytable.MYD, and mytable.MYI.

29.4.1. The InnoDB Tablespace and Logs


Each InnoDB table has a format (.frm) file in the database directory of the database to which the table
belongs. This is the same as tables managed by any other MySQL storage engine, such as MyISAM. However,
InnoDB manages table contents (data rows and indexes) on disk differently than does the MyISAM engine. By
default, InnoDB uses a shared "tablespace," which is one or more files that form a single logical storage area.
All InnoDB tables are stored together within the tablespace. There are no table-specific data files or
index files for InnoDB the way there are for MyISAM tables. The tablespace also contains a rollback
segment. As transactions modify rows, undo log information is stored in the rollback segment. This information
is used to roll back failed transactions.

QUESTION 5
Which of the following is true for the command-line programs mysqlcheck and myisamchk?

A. mysqlcheck must run on the server to perform checks and repairs and myisamchk can perform checks and
repairs on a remote server.
B. mysqlcheck can perform checks and repairs on a remote server, and myisamchk must run on the server.
C. Both mysqlcheck and myisamchk can perform checks and repairs on a remote server.
D. Neither mysqlcheck or myisamchk can perform checks and repairs on a remote server.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
30.3.
The myisamchk utility for MyISAM tables also performs table maintenance. However, it takes a different
approach from MySQL Administrator and mysqlcheck. Rather than sending SQL statements to the server,
myisamchk directly reads and modified the table files. For this reason, it's necessary when using myisamchk to
ensure that the server does not access the tables at the same time.

QUESTION 6
MySQL is a multi-threaded database server. Every connection to the database server is handled by it's own
thread.

A. True
B. False

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
23.5.
The server is multi-threaded, and a thread is like a small process running inside the server. For each client that
connects, the server allocates a thread to it to handle the connection.

QUESTION 7
mysqldump can be instructed to dump...

http://www.gratisexam.com/

A. Only table structures


B. Only data
C. Both table structures and data

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
32.4.2.
The mysqldump client program dumps table contents to files. It can dump all databases, specific databases, or
specific tables.

QUESTION 8
Which of the following is true of a MySQL client and server?

A. They must be run on the same type of Operating System.


B. They must be run on the same hardware architecture.
C. They do not have to be run on the same type of Operating System.
D. They do not have to be run on the same hardware architecture.

Correct Answer: CD
Section: (none)
Explanation

Explanation/Reference:

QUESTION 9
Which of the following APIs/connectors are included in a MySQL distribution?

A. Connector/J
B. Connector/ODBC
C. C API
D. Connector/NET
E. Connector/MJX

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:

QUESTION 10
Of the following mechanisms available to connect a MySQL client to a MySQL database server, which types of
connections are only available on Windows based systems?

A. TCP/IP
B. Sockets
C. Shared Memory
D. Named Pipes

Correct Answer: CD
Section: (none)
Explanation

Explanation/Reference:

QUESTION 11
Which of the following statements correctly describes the way to enable and use shared memory connections
to the MySQL database server?

A. Shared memory connections are available by default on all platforms, but must have TCP/IP networking
disabled by using the --skip-networking option.
B. Shared memory connections are supported on all windows binaries, and is enabled by default.
C. Shared memory connections are supported on all windows binaries, and must be enabled by using the --
shared-memory command line option.
D. Shared memory is not a supported communication method for the MySQL database server.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:

QUESTION 12
Which mysqld command line option disables incoming TCP/IP connections?

A. --shared-memory
B. --memlock
C. --no-networking
D. --skip-networking

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
35.5.2.1 Restricting the Server's Network Interfaces
To prevent remote clients from connecting at all, disable TCP/IP connections by starting the server with the --
skip-networking option.
QUESTION 13
When making connections to a MySQL server on a Unix platform, which of the following is true?

A. TCP/IP connections are faster than socket file connections.


B. Socket file connections are faster than TCP/IP connections.
C. TCP/IP and Socket file connections are equally as fast.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
23.2. Communication Protocols
On Unix, a Unix socket file connection provides better performance than a TCP/IP connection.

QUESTION 14
Which of the following best describes the processing model for how the MySQL server handles queries?

A. The server uses a one-tier processing model in which each storage engine optimizes and processes each
query issued against it.
B. The server uses a two-tier processing model: a SQL/optimizer tier and a storage engine tier.
C. The server uses a three-tier processing model: a SQL/optimizer tier, a formatting tier and a storage engine
tier.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
23.3. The SQL Parser and Storage Engine Tiers
The upper tier includes the SQL parser and optimizer.
The lower tier comprises a set of storage engines.

QUESTION 15
Which of the following best describes how MySQL utilizes the grant table buffers?

A. The grant table buffer loads grant table information into memory for fast access.
B. The grant table buffer loads what users are currently logged in and performing queries.
C. The grant table buffer holds requests waiting to check the grant table to perform access-control.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
23.5. How MySQL Uses Memory
The grant tables store information about MySQL user accounts and the privileges they have. The server loads
a copy of the grant tables into memory for fast access-control checking.

QUESTION 16
In a standard MySQL installation which of following files are stored below the data directory?

A. Format files for all the tables


B. Data and index files for MyISAM tables
C. InnoDB tablespace files
D. General server logs
E. MySQL upgrade script files

Correct Answer: ABCD


Section: (none)
Explanation

Explanation/Reference:

QUESTION 17
Where is the data stored for a table that is defined as using the FEDERATED Storage Engine?

A. The data will always be stored on the local host.


B. The data will always be stored on a remote host.
C. The data can be stored on any host depending on the definition of the table.
D. The data will always be stored on disk.
E. The data will always be stored in memory.
F. The data will be stored according to the storage engine of the referenced table.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.6. The FEDERATED Engine
"Remote" in the preceding discussion actually is not quite accurate: FEDERATED tables can be defined for
accessing tables from other servers running on the same host, or even other tables from the same server.

QUESTION 18
Which of the following statements are true regarding the data directory on a Windows binary installation?

A. A script needs to be run to initialize it after installation.


B. It comes pre-initialized.
C. You can choose to pre-initialize it or initialize it manually during the installation.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
24.2.1. Server Startup Prerequisites on Windows
For MySQL installations on Windows, the data directory is preconfigured and ready to use.

QUESTION 19
Which of the following are requirements for InnoDB binary portability?

A. Both machines must use the same operating system.


B. Database and table names must use lowercase format.
C. Both machines must use two's-complement integer arithmetic.
D. Both machines must use IEEE floating-point format or contain no floating-point columns.

Correct Answer: BCD


Section: (none)
Explanation
Explanation/Reference:
29.4. The InnoDB Engine
The tablespace storage format is portable, so InnoDB files can be copied directly to another host and used by
a server there. The conditions for InnoDB portability are given at Section 32.3.4.

32.3.4. Conditions for Binary Portability


MyISAM tables and InnoDB tablespaces are binary portable from one host to another if two conditions are met:
Both machines must use two's-complement integer arithmetic.
Both machines must use IEEE floating-point format, or else the tables must contain no floating-point
columns (FLOAT or DOUBLE).
A third condition for InnoDB binary portability is that you should use lowercase names for databases and
tables.

QUESTION 20
Which of the following package types are provided specifically for UNIX-style OS installations?

A. Essentials
B. RPM
C. Source
D. tar-packaged binary

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:

QUESTION 21
Which of the following are some benefits of using MySQL built binaries over binaries built by yourself?

A. They are highly optimized.


B. They are cross-platform.
C. Many are built using commercial compilers that produce a better quality build than with freely available
compilers.
D. They will work with tools such as MySQL Administrator and MySQL Query Browser.
E. They may include libraries not available in the standard operating system library.

Correct Answer: ACE


Section: (none)
Explanation

Explanation/Reference:
24.1.2. MySQL Source Distributions
One significant benefit is that binaries produced by MySQL are likely to provide better performance than those
you build yourself:
MySQL AB has a great deal of experience selecting configuration options such as compiler switches that
produce the most highly optimized binaries.
In many cases, MySQL AB uses commercial compilers that produce superior quality code compared to the
compilers typically available for general-purpose use.
In some cases, MySQL AB produces binaries compiled with libraries that provide capabilities beyond those
available in the standard operating system vendor libraries. For example, on Linux systems, a special C
library is used that allows a higher maximum number of concurrent connections than can be achieved using
the stock C library. Other times, binaries are built using special libraries that work around known bugs in
vendor libraries.

QUESTION 22
A windows binary installation includes several servers in the MySQL installation directory. What is the purpose
of the mysqld-nt server?

A. It is the standard server with no extra features


B. It is the standard server with additional support for named pipes.
C. It is the standard server with additional support for named pipes and extra storage engines.
D. It is a debug-version of the server with named pipes and error reporting facilities to help track down errors in
the server.
E. It is the standard server, compiled to be optimized forWindows NT 4.0 (but not otherWindows versions).

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
24.2.1. Server Startup Prerequisites on Windows
mysqld-nt is like mysqld, but includes support for named pipes on NT-based systems such as Windows NT,
2000, XP, and 2003.

QUESTION 23
When running the MySQL server under Windows, the --console option is used to display server errors in the
console window.

A. True
B. False

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
24.2.2. Running MySQL Server Manually on Windows
If the server does not start properly, check the error log in the data directory to see why. Alternatively, to display
diagnostic output in the console window instead, invoke the server with the --console option.

QUESTION 24
What will the following statement do in a Windows environment? Assume that there are no conflicts in the
pathname definitions.

C:\> mysqld --install MySQL50 --defaults-file=C:\my-opts.cnf

A. MySQL 5.0 will be installed using default configuration file C:\my-opts.cnf.


B. MySQL will be installed as Windows service name MySQL50 and will use C:\my-opts.cnf as configuration
file.
C. An error message will be issued as --install is not a valid option for mysqld.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
24.2.
shell> mysqld --install my_service
shell> mysqld --install my_service --defaults-file=C:\server-opts
shell> mysqld --remove my_service
shell> net start my_service shell> net stop my_service
QUESTION 25
Suppose you install a server with a service name of "MySQL5" rather than the default.What sections in the
option files will the server use for configuration?

A. [service]
B. [MySQL5]
C. [service MySQL5]
D. [mysqld]
E. [mysqld MySQL5]

Correct Answer: BD
Section: (none)
Explanation

Explanation/Reference:
24.2.
If you install a server using a service name other than MySQL and do not specify a --defaults-file option,
the server reads options in the standard option files from the [my_service] group in addition to options from
the [mysqld] group.

QUESTION 26
Assume you compile MySQL from source and invoke configure with the following options.

--with-charset=latin1 --with-extra-charsets=utf8,ucs2

Compared to a standard binary installation that contains many more character sets, which of the following
statements is/are true?

A. The compiled version will use less disk space, because only a few character sets will be installed on disk.
B. The compiled version will use less memory, because only a few character sets will be loaded by the server.
C. The compiled version will use less file handles, because only a few files need to be opened when the server
is started.

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
27.1. Performance Issues
To reduce the amount of disk space required by character sets for your MySQL installation and the amount of
memory used by the server as it runs, don't select unneeded character sets when you configure MySQL. This
requires that you compile MySQL from source rather than using a precompiled binary distribution.

QUESTION 27
Which of the following can be influenced by the choice of character set?

A. Disk usage when storing data.


B. Syntax when writing queries involving JOINs
C. The time taken to read & write table rows on disk.
D. Memory usage.

Correct Answer: ACD


Section: (none)
Explanation
Explanation/Reference:

QUESTION 28
Suppose you have a column in which most records are going to be between 30 and 32 characters. Which of
the following column types would be most efficient?

A. VARCHAR
B. CHAR
C. TEXT
D. Either VARCHAR or CHAR

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
27.2. Choosing Data Types for Character Columns
If stored string values all have the same length, use a fixed-length type rather than a variable-length type. To
store values that are always 32 characters long, CHAR(32) requires 32 characters each, whereas VARCHAR
(32) requires 32 characters each, plus an extra byte to store the length. In this case, VARCHAR requires one
byte more per value than CHAR.

QUESTION 29
You are using a multi-byte character set with variable-length encoding. You need to store records whose values
are always 20 characters. Which of the following column types would be the most efficient to use in terms of
storage space?

A. CHAR
B. VARCHAR
C. The storage requirements for CHAR or VARCHAR would be the same

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
27.2. Choosing Data Types for Character Columns
For multi-byte character sets that have variable-length encoding, a variable-length data type may be appropriate
even if stored values always have the same number of characters. The utf8 character set uses one to three
bytes per characters. For fixed-length data types, three bytes per character must always be allocated to allow
for the possibility that every character will require the "widest" encoding. Thus, CHAR(32) requires 96 bytes,
even if most stored values contain 32 single-byte characters. For variable-length data types, only as
much storage is allocated as required. In a VARCHAR(32) column, a 32-character string that consists
entirely of three-byte characters requires 96 bytes plus a length byte, whereas it requires only 32 bytes plus a
length byte if the string consists entirely of single-byte characters.

QUESTION 30
Another user has gotten a lock using GET_LOCK. You inquire on the status of the lock by using

A. RELEASE_LOCK
B. IS_FREE_LOCK
C. IS_USED_LOCK
D. Another GET_LOCK
E. LOCK TABLES
Correct Answer: BC
Section: (none)
Explanation

Explanation/Reference:
28.3. Advisory Locking
Two other functions are available for checking the status of advisory locks:
IS_FREE_LOCK(lock_name) returns 1 if the name is not locked, 0 if it is locked, and NULL if an error
occurs.
IS_USED_LOCK(lock_name) returns the connection ID of the client that holds the lock on the name, or
NULL if the name is not locked.

QUESTION 31
Another user has issued the statement LOCK TABLE pets FOR WRITE You can...

A. Update table pets


B. SELECT from table pets
C. UPDATE and SELECT from table pets
D. None of the above

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
When a table is locked for reading, other clients can read from the table at the same time, but no client can
write to it. Once acquired, only the client holding the write lock can read from or write to the table. Other clients
can neither read from nor write to it. No other client can lock the table for either reading or writing.

QUESTION 32
Index analysis and optimization using ANALYZE and OPTIMIZE statements should...

A. generally never be run manually


B. be run once the table reaches 100,000 rows or above
C. be run when more than 5% of the rows are changed by a single statement
D. be run when EXPLAIN SELECT shows that an inordinate amount of rows is expected to be read during
query execution
E. be run when you suspect that a table is heavily fragmented

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
30.2. SQL Statements for Table Maintenance
The ANALYZE TABLE statement updates a table with information about the distribution of key values in the
table. This information is used by the optimizer to make better choices about query execution plans. This
statement works for MyISAM and InnoDB tables.
The OPTIMIZE TABLE statement cleans up a MyISAM table by defragmenting it. This involves reclaiming
unused space resulting from deletes and updates, and coalescing records that have become split and
stored non-contiguously. OPTIMIZE TABLE also sorts the index pages if they are out of order and updates
the index statistics.

QUESTION 33
Which of the following best describes the scope of explicitly and implicitly set locks?
A. Explicitly set locks may span several commands.
B. Implicitly set locks may span several commands.
C. Implicitly set locks will span only one statement or transaction.
D. Explicitly set locks will span only one statement or transaction.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
28.1. Locking Concepts
For a client that does nothing special to acquire locks, the MySQL server implicitly acquires locks as necessary
to process the client's statements safely. For example, the server acquires a read lock when the client issues a
SELECT statement and a write lock when the client issues an INSERT statement. Implicit locks are acquired
only for the duration of a single statement.
Explicit locking may be necessary when a client needs to perform an operation that spans multiple statements
and that must not be interrupted by other clients.

QUESTION 34
When you acquire an advisory lock using GET_LOCK(), the lock is released if

A. You issue another GET_LOCK() statement


B. You issue a RELEASE_LOCK() statement
C. Your connection to the server terminates
D. None of the above

Correct Answer: ABC


Section: (none)
Explanation

Explanation/Reference:
28.3. Advisory Locking
A client that has acquired an advisory lock can release it by calling RELEASE_LOCK().
An advisory lock also is released if the client makes another call to GET_LOCK() or closes its connection to
the server.

QUESTION 35
Which of the following best describes why table locking is often not desirable compared to page or row locking?

A. Table locks can have deadlocks.


B. Table locks create concurrency issues.
C. Table locks prevent other clients from making any changes to the table until released.
D. Table locks can cause data corruption issues if more than one client tries to make changes while locked.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
28.1. Locking Concepts
Table locking is not as desirable as page or row locking for concurrency in a mixed read/write environment.
A table lock prevents other clients from making any changes to the table, even if the client that holds the
lock is not accessing the parts of the table that other clients want to modify. With page and row locks, a
client that locks a page or row does not prevent changes by other clients to other pages or rows.
Deadlock cannot occur with table locking as it can with page or row locking.
QUESTION 36
With MyISAM table locking, deadlocks do not occur because:

A. All tables to be locked are sorted in an internally defined order


B. If a table is locked with a read lock and a write lock, the write lock is set before the read lock
C. Tables are locked one table at a time until the thread gets all the locks
D. None of the above

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
28.1. Locking Concepts
With table locking, the server can determine what locks are needed and acquire them before executing a
statement, so deadlock never occurs.

QUESTION 37
Which of the following (series of) statements will leave the three tables A, B and C locked for reading,

writing and reading respectively once all statements have been executed?

A. mysql> LOCK TABLES A;mysql> LOCK TABLES B;mysql> LOCK TABLES C;


B. mysql> LOCK TABLES A READ;mysql> LOCK TABLES B WRITE;mysql> LOCK TABLES C READ;
C. mysql> LOCK TABLES A READ, B WRITE, C READ;
D. LOCK TABLES A, B, C READ, WRITE, READ;

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
If you need to use multiple tables while holding an explicit lock, you must lock all of them at the same time
because you cannot use any unlocked tables while you hold explicit locks. Also, you must lock all the tables
with a single LOCK TABLES statement. LOCK TABLES releases any locks that you already hold, so you cannot
issue it multiple times to acquire multiple locks.

QUESTION 38
You want to lock the three tables a, b and c, and issue the following statements:

mysql> LOCK TABLES a READ;

mysql> LOCK TABLES b READ;

mysql> LOCK TABLES c READ;

Which tables are now locked?

A. Tables a, b and c
B. Table a only
C. Table c only
D. None of the tables are locked

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
If you need to use multiple tables while holding an explicit lock, you must lock all of them at the same time
because you cannot use any unlocked tables while you hold explicit locks. Also, you must lock all the tables
with a single LOCK TABLES statement. LOCK TABLES releases any locks that you already hold, so you cannot
issue it multiple times to acquire multiple locks.

QUESTION 39
When choosing a storage engine for each of your tables, which things are to consider?

A. Locking Characteristics: Some storage engines lock on row level, some on page level, some on table level.
B. Transactions support: Some storage engines support transactions, some don't.
C. Storage media: Some storage engines store data on disk, some in memory.
D. Licenses: Some storage engines cannot be used in commercial environments, others can.
E. Backup methods: Some storage engines support online backup and point in time recovery, some don't.

Correct Answer: ABC


Section: (none)
Explanation

Explanation/Reference:
Point in time recovery is not a feature of a storage engine.
http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

QUESTION 40
Which of the following variables specify the default storage engine to use if no storage engine is specified when
creating a table?

A. default_engine
B. storage_default
C. storage_engine
D. default_storage_engine

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.1. MySQL Storage Engines
If you create a table without using an ENGINE option to specify a storage engine explicitly, the MySQL server
creates the table using the default engine, which is given by the value of the storage_engine system variable

QUESTION 41
Which of the following methods can be used to determine the storage engine of your table named "Country"?

A. SHOW CREATE TABLE Country


B. SHOW STORAGE ENGINE Country
C. SHOW TABLE STATUS LIKE 'Country'
D. SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Country'

Correct Answer: ACD


Section: (none)
Explanation
Explanation/Reference:

QUESTION 42
Which of the following storage engines cannot be disabled?

A. InnoDB
B. MyISAM
C. FEDERATED
D. MEMORY
E. MERGE

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
29.2. The MyISAM Engine
MyISAM was introduced in MySQL 3.23.0 and has been the built-in default storage engine since (although you
can change the default engine at server startup or while the server runs). Because MyISAM is the built-in
default engine, it is always available and cannot be disabled.

QUESTION 43
Which of the following features are supported by MyISAM tables?

A. Foreign key constraints


B. Transactions
C. Auto_increment columns
D. Fulltext indexes
E. Assembly of multiple MyISAM tables to a MERGE table
F. Row level locking
G. Table level locking

Correct Answer: CDEG


Section: (none)
Explanation

Explanation/Reference:
29.2. The MyISAM Engine
MyISAM has the most flexible AUTO_INCREMENT column handling of all the storage engines.
MyISAM tables can be used to set up MERGE tables.
MyISAM tables can be converted into fast, compressed, read-only tables to save space.
MyISAM supports FULLTEXT searching and spatial data types.

QUESTION 44
Which of the following actions are performed during an RPM installation of the MySQL server package?

A. Setup a mysql user


B. Setup a mysql group
C. Initialize the data directory
D. Setup passwords for all default accounts.

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
During RPM installation, a user named mysql and a group named mysql are created on the system. This
is done using the useradd, groupadd, and usermod commands. Those commands require appropriate
administrative privileges, which is required for locally managed users and groups (as listed in the /etc/passwd
and /etc/group files) by the RPM installation process being run by root.
http://dev.mysql.com/doc/refman/5.1/en/linux-installation-rpm.html

QUESTION 45
When installing a RPM based distribution, the data directory will be set to which of the following locations?

A. /var/lib/mysql
B. /usr/mysql/data
C. /var/mysql/data
D. /usr/local/mysql/data

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
The server RPM places data under the /var/lib/mysql directory.
http://dev.mysql.com/doc/refman/5.1/en/linux-installation-rpm.html

QUESTION 46
Which of the following list the difference between mysqld, mysqld_safe and mysql.server respectively?

A. mysqld is the server; mysqld_safe is a shell script that invokes mysqld; mysql.server is a wrapper for
mysqld_safe.
B. mysqld is a shell script that starts mysql.server; mysqld_safe is a shell script that invokes the server in safe
mode; mysql.server is the server.
C. mysqld is the server; mysqld_safe is a shell script that invokes mysqld in safe mode, and mysql.server is a
wrapper for mysqld_safe.
D. Nothing. They are symbloic links to the same file.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
24.3.2. Choosing a Server Startup Method on Unix
You can invoke mysqld manually. This is usually not done except for debugging purposes. If you invoke the
server this way, error messages go to the terminal by default rather than to the error log.
mysqld_safe is a shell script that invokes mysqld. The script sets up the error log, and then launches
mysqld and monitors it. If mysqld terminates abnormally, mysqld_safe restarts it.
mysql.server is a shell script that invokes mysqld_safe. It's used as a wrapper around mysqld_safe for
systems such as Linux and Solaris that use System V run-level directories. Typically, this script is renamed
to mysql when it is installed in a run-level directory.

QUESTION 47
Which of the following commands can be used to stop a MySQL server on a UNIX system?

A. mysqladmin shutdown
B. mysqld_multi stop
C. mysql shutdown
D. mysql.server stop
E. mysqld shutdown

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
24.3.2. Choosing a Server Startup Method on Unix

To stop the server manually, use one of the following techniques:


The mysqladmin program has a shutdown command. It connects to the server as a client and can shut
down local or remote servers.
The mysql.server script can shut down the local server when invoked with an argument of stop.
The mysqld_multi script has a stop command and can shut down any of the servers that it manages. It
does so by invoking mysqladmin.

QUESTION 48
On a Unix host with the host name "sakila", where will mysqld write errors to?

A. stdin
B. stdout
C. sakila.out

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
24.3.2. Choosing a Server Startup Method on Unix
You can invoke mysqld manually. This is usually not done except for debugging purposes. If you invoke the
server this way, error messages go to the terminal by default rather than to the error log. mysqld_safe is
a shell script that invokes mysqld. The script sets up the error log, and then launches mysqld and monitors it.
If mysqld terminates abnormally, mysqld_safe restarts it.

QUESTION 49
When starting the mysqld program, which of the following statements are true?

A. Startup options can only be given in option files.


B. Startup options can only be given on the command line.
C. Startup options can only be given on the command line except for Windows Services.
D. Startup options can be given either in option files, or as parameters on the command line.
E. Startup options can be given either in option files, or as parameters on the command line, except for
Windows services.

Correct Answer: E
Section: (none)
Explanation

Explanation/Reference:
24.2.3. Running MySQL Server as a Windows Service
The --install command does not actually start the server. It only tells Windows to handle the server as a
service, so that when Windows starts up and shuts down, it starts and stops mysqld automatically. The service
also can be started or stopped manually from the command line. To do so, use these commands:
shell> net start MySQL
shell> net stop MySQL
MySQL is the service name for MySQL. It can be given in any lettercase.

QUESTION 50
Which types of startup options can be configured for the server?

A. Location of important directories and files


B. Logging settings
C. Backup intervals
D. Storage Engine dependent options
E. Performance related settings
F. The root password

Correct Answer: ABCDE


Section: (none)
Explanation

Explanation/Reference:

QUESTION 51
When specifying options, which of the following are valid advantages of using options files over parameters on
a command line?

A. Options will not need to be specified every time the server starts.
B. All options can be consolidated to one file and a single point of reference.
C. Certain options can be specified only in options files but not on the command line

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
Option files provide a convenient way to specify commonly used options so that they need not be entered on
the command line each time you run a program.
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
Table 5.2. System Variable Summary shows that all cmd-line options are also available for the option file
with no exclusions.
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html

QUESTION 52
Which of the following statements are true for MyISAM tables?

A. By default, write requests (such as UPDATE and DELETE statements) take priority over read requests
(such as SELECT statements).
B. By default, read requests (such as SELECT statements) take priority over write requests (such as
UPDATE and DELETE statements).
C. With the LOW_PRIORITY option, a write request will wait for any other read request to finish.
D. With the LOW_PRIORITY option, a read request will wait for any other write request to finish.
E. With the HIGH_PRIORITY option, a read request will be moved ahead of other requests waiting to be
executed.

Correct Answer: ACE


Section: (none)
Explanation

Explanation/Reference:
29.2.1. MyISAM Locking Characteristics
By default, the server schedules queries for execution as follows:
Write requests (such as UPDATE and DELETE statements) take priority over read requests (such as
SELECT statements).
The server tries to perform write requests in the order that it receives them.

When working with MyISAM tables, certain scheduling modifiers are available to change the priority of requests:
The LOW_PRIORITY modifier may be applied to statements that update tables (INSERT, DELETE,
REPLACE, or UPDATE). A low-priority write request waits not only until all current readers have finished, but
for any pending read requests that arrive while the write request itself is waiting.
HIGH_PRIORITY may be used with a SELECT statement to move it ahead of updates and ahead of other
SELECT statements that do not use the HIGH_PRIORITY modifier.

QUESTION 53
Suppose your are adding rows to a MyISAM table and the server runs out of disk space. What will happen?

A. The server will crash.


B. An error message will be returned to the client.
C. The server suspends that INSERT operation until space becomes available.
D. The server suspends operations on all MyISAM tables until space becomes available.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.2. The MyISAM Engine
If you run out of disk space while adding rows to a MyISAM table, no error occurs. The server suspends the
operation until space becomes available, and then completes the operation.

QUESTION 54
When working with MyISAM tables, which of the following statements are true regarding deadlocks?

A. Deadlocks are possible because of the MyISAM-specific method of table-level locking.


B. Deadlocks are not possible because of the MyISAM-specific method of table-level locking.
C. Deadlocks are possible because of the MyISAM-specific method of row-level locking.
D. Deadlocks are not possible because of the MyISAM-specific method of row-level locking.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:

QUESTION 55
Which of the following are characteristics of the MyISAM fixed-row storage format as compared to the dynamic
row format?

A. All rows have the same size.


B. Rows take varying amounts of space.
C. Rows are easy to look up.
D. Rows cannot be looked up as efficiently.
E. Row data usually takes up more space on disk and in memory.
Correct Answer: ACE
Section: (none)
Explanation

Explanation/Reference:
29.2.2. MyISAM Row-Storage Formats
Fixed-row format:
All rows have the same size.
Rows are stored within the table at positions that are multiples of the row size, making them easy to look up.
Fixed-size rows take more space.
Dynamic-row format:
Rows take varying amounts of space.
Rows cannot be looked up as efficiently.
Dynamic-rows tables usually take less space because rows are not padded to a fixed size.
Fragmentation can occur more easily than for fixed-row tables.

QUESTION 56
Which of the following statements are true for the MERGE storage engine?

A. It uses table-level locking.


B. It uses row-level locking.
C. Underlying MyISAM tables are read-locked when you issue a SELECT statement on a MERGE table.
D. Underlying MyISAM tables are write-locked when you issue a SELECT statement on a MERGE table.
E. Underlying MyISAM tables are read-locked when you issue a statement that modifies a MERGE table.
F. Underlying MyISAM tables are write-locked when you issue a statement that modifies a MERGE table.
G. To LOCK a MERGE table, it is sufficient to lock just that table.
H. To LOCK a MERGE table, you need to lock all underlying MyISAM tables as well.

Correct Answer: ACFG


Section: (none)
Explanation

Explanation/Reference:
29.3.1. MERGE Locking Characteristics
The MERGE storage engine uses table-level locking. However, because a MERGE table is defined in terms of
other tables, MERGE locking involves locks on those tables as well:
When the MERGE engine acquires a lock for a MERGE table, it acquires a lock for all the underlying MyISAM
tables. Thus, all the tables are locked together.
The underlying MyISAM tables are read-locked when you issue a SELECT statement for a MERGE table.
The underlying MyISAM tables are write-locked when you issue a statement that modifies a MERGE table,
such as INSERT or DELETE.
To explicitly lock a MERGE table with LOCK TABLES, it is sufficient to lock just that table. You need not lock
the underlying MyISAM tables as well.

QUESTION 57
When will you be able to copy InnoDB table space files to other systems and use the data there?

A. You can always use them, because InnoDB files are platform independent.
B. Both systems need to be either 32 Bit or 64 Bit platforms.
C. Both systems need to run the same operating system.
D. Both systems must be either little endian or big endian architecture.

Correct Answer: A
Section: (none)
Explanation
Explanation/Reference:
32.3.4. Conditions for Binary Portability
MyISAM tables and InnoDB tablespaces are binary portable from one host to another if two conditions are met:
Both machines must use two's-complement integer arithmetic.
Both machines must use IEEE floating-point format, or else the tables must contain no floating-point
columns (FLOAT or DOUBLE).
In practice, those two conditions pose little restriction. Two's-complement integer arithmetic and IEEE
floating-point format are the norm on modern hardware.
A third condition for InnoDB binary portability is that you should use lowercase names for databases and
tables.

QUESTION 58
Which of the following statements are true regarding the InnoDB storage engine?

A. It uses multiversioning to isolate transactions.


B. It is not possible for deadlocks to occur.
C. It does not isolate transactions.
D. It is possible for deadlocks to occur.

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
29.4. The InnoDB Engine
MySQL manages query contention for InnoDB tables using multi-versioning and row-level locking. Multi-
versioning gives each transaction its own view of the database. This, combined with row-level locking, keeps
contention to a minimum. The result is good query concurrency even if clients are performing a mix of reads
and writes. However, it's possible for deadlock to occur.

QUESTION 59
Which of the following statements are true?

A. InnoDB tables will be automatically recovered after a crash.


B. MyISAM tables will be automatically recovered after a crash.
C. InnoDB tables will be recovered after a crash if the innodb-recover option is configured.
D. MyISAM tables will be recovered after a crash if the myisam-recover option is configured.
E. InnoDB tables cannot be recovered after a crash, you have to restore data from backup.
F. MyISAM tables cannot be recovered after a crash, you have to restore data from backup.

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
29.4. The InnoDB Engine
InnoDB provides auto-recovery after a crash of the MySQL server or the host on which the server runs.

30.2.2. REPAIR TABLE


The REPAIR TABLE statement corrects problems in a table that has become corrupted. It works only for
MyISAM tables.

30.5. Enabling MyISAM Auto-Repair


You can tell the server to repair MyISAM tables automatically.
To enable automatic MyISAM table maintenance, start the server with the --myisam-recover option.
QUESTION 60
Which of the following statements are true?

A. InnoDB supports Foreign Keys.


B. MyISAM supports Foreign Keys.
C. InnoDB supports cascaded DELETE statements.
D. MyISAM supports cascaded DELETE statements.
E. InnoDB supports cascaded UPDATE statements.
F. MyISAM supports cascaded UPDATE statements.

Correct Answer: ACE


Section: (none)
Explanation

Explanation/Reference:

QUESTION 61
When you set up per-table tablespace files for InnoDB...

A. Shared tablespace files are not needed.


B. Occasionally shared tablespace files are still needed.
C. Shared tablespace files are still needed.
D. Per-table tablespace files cannot be used with InnoDB.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
InnoDB always needs the shared tablespace because it puts its internal data dictionary and undo logs there.
The .ibd files are not sufficient for InnoDB to operate.
http://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html

QUESTION 62
Which of the following happens when BEGIN TRANSACTION or START TRANSACTION command is issued?

A. Autocommit mode overrides BEGIN TRANSACTION and START TRANSACTION.


B. Autocommit mode is suspended and has to be re-enabled explicitly.
C. Autocommit mode is suspended until COMMIT.
D. Nothing happens as they are not valid commands.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.4.3. The InnoDB Transaction Model
The second method is to suspend the current autocommit mode by beginning a transaction explicitly. Any of the
following statements begins a transaction:
START TRANSACTION;
BEGIN;
BEGIN WORK;
http://www.gratisexam.com/

QUESTION 63
Which of the following statements are true with regard to savepoints in transactions?

A. Within a transaction, you can define multiple savepoints


B. All savepoints must have unique identifiers
C. You can rollback to any previous savepoint.
D. You can rollback to only the latest savepoint.
E. If you rollback to a previous savepoint, all statements after this savepoint are rolled back and cannot be
reissued.
F. If you rollback to a previous savepoint, you still can replay the statements after this savepoint.

Correct Answer: ABCE


Section: (none)
Explanation

Explanation/Reference:
29.4.3. The InnoDB Transaction Model
If you want to roll back only part of a transaction, you can set a savepoint by using the SAVEPOINT statement:
SAVEPOINT savepoint_name;
Multiple savepoints can be set within a transaction.
-----
The SAVEPOINT statement sets a named transaction savepoint with a name of identifier.
If the current transaction has a savepoint with the same name, the old savepoint is deleted and a
new one is set.
The ROLLBACK TO SAVEPOINT statement rolls back a transaction to the named savepoint without
terminating the transaction.
Modifications that the current transaction made to rows after the savepoint was set are undone in the
rollback, but InnoDB does not release the row locks that were stored in memory after the savepoint.
http://dev.mysql.com/doc/refman/5.0/en/savepoint.html

QUESTION 64
Some statements implicitly commit pending transactions and start a new one.

A. True
B. False

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
29.4.3. The InnoDB Transaction Model
If you issue any of the following statements, InnoDB implicitly commits the preceding uncommitted statements
of the current transaction and begins a new transaction:
ALTER TABLE
BEGIN
CREATE INDEX
DROP DATABASE
DROP INDEX
DROP TABLE
RENAME TABLE
TRUNCATE TABLE
LOCK TABLES
UNLOCK TABLES
SET AUTOCOMMIT = 1
START TRANSACTION

QUESTION 65
Which of the following describes how deadlocks may occur and how InnoDB resolves them?

A. Deadlocks happen anytime when more than one lock is placed in a table.
B. Deadlocks happen when two transactions both have locks that the other is waiting for the release of the lock
that the other holds.
C. InnoDB resolves deadlocks by terminating and rolling back one of the deadlocking transactions.
D. InnoDB resolves deadlocks by terminating and rolling back both of the deadlocking transactions.

Correct Answer: BC
Section: (none)
Explanation

Explanation/Reference:
29.4.4. InnoDB Locking Characteristics
Deadlock can occur. Deadlock is a situation in which each of two transactions is waiting for the release of a
lock that the other holds. For example, if two transactions each lock a different row, and then try to modify the
row locked by the other, they can deadlock. Deadlock is possible because InnoDB does not acquire locks
during a transaction until they are needed. When InnoDB detects a deadlock, it terminates and rolls back
one of the deadlocking transactions. It tries to pick the transaction that has modified the smallest number of
rows. If InnoDB does not detect deadlock, the deadlocked transactions eventually begin to time out and
InnoDB rolls them back as they do.

QUESTION 66
LOCK IN SHARE MODE should be used...

A. When you need a lock that does not allow other transactions to read, update or delete the same data until
released.
B. When you need a lock that allows other transactions to read the same data, but not update or delete until
released.
C. When you need a lock that allows other transactions to read, update and delete the same locked data.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
29.4.4. InnoDB Locking Characteristics
With LOCK IN SHARE MODE, InnoDB locks each selected row with a shared lock. Other transactions can still
read the selected rows, but cannot update or delete them until the first transaction releases the locks, which
happens when the transaction finishes. Also, if the SELECT will select rows that have been modified in an
uncommitted transaction, IN SHARE MODE will cause the SELECT to block until that transaction commits.

QUESTION 67
When working with InnoDB, for which of the following reasons should you use the FOR UPDATE locking
modifier?
A. You intend to run more than ten UPDATE statements in one transaction.
B. You intend to execute an UPDATE statement on any row.
C. You intend to SELECT a set of rows, then modify those rows.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.4.4. InnoDB Locking Characteristics
With FOR UPDATE, InnoDB locks each selected row with an exclusive lock. This is useful if you intend to
select and then modify a set of rows, because it prevents other transactions from reading or writing the rows
until the first transaction releases the locks, which happens when the transaction finishes.

QUESTION 68
Which of the following correctly defines dirty reads, non-repeatable reads and phantom row?

A. A dirty read is a read by one transaction of uncommitted changes made by another transaction.
B. A dirty read is a read by one transaction of its uncommitted changes.
C. A non-repeatable read occurs when a transaction performs the same retreival twice but gets a different
result each time.
D. A non-repeatable read is a row that appears where it was not visible before.
E. A phantom is a row that appears where it was not visible before.
F. A phantom is a read by one transaction of uncommitted changes made by another transaction.

Correct Answer: ACE


Section: (none)
Explanation

Explanation/Reference:
29.4.5. InnoDB Isolation Levels, Multi-Versioning, and Concurrency
When multiple clients run transactions concurrently, three problems that may result are dirty reads, non-
repeatable reads, and phantoms. These occur under the following circumstances:
A dirty read is a read by one transaction of uncommitted changes made by another. Suppose that
transaction T1 modifies a row. If transaction T2 reads the row and sees the modification even though T1
has not committed it, that is a dirty read. One reason this is a problem is that if T1 rolls back, the change is
undone but T2 does not know that.
A non-repeatable read occurs when a transaction performs the same retrieval twice but gets a different
result each time. Suppose that T1 reads some rows and that T2 then changes some of those rows and
commits the changes. If T1 sees the changes when it reads the rows again, it gets a different result; the
initial read is non-repeatable. This is a problem because T1 does not get a consistent result from the same
query.
A phantom is a row that appears where it was not visible before. Suppose that T1 and T2 begin, and T1
reads some rows. If T2 inserts a new row and T1 sees that row when it reads again, the row is a phantom.

QUESTION 69
When working with the InnoDB engine, which of the following correctly defines the READ UNCOMMITTED
isolation level?

A. It allows a transaction to only see its uncommitted changes.


B. It allows a transaction to see committed changes made by other transactions.
C. It allows a transaction to see uncommitted changes made by other transactions.
D. It allows a transaction to see both committed/uncommitted changes made by other transactions.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.4.5. InnoDB Isolation Levels, Multi-Versioning, and Concurrency
READ UNCOMMITTED allows a transaction to see uncommitted changes made by other transactions. This
isolation level allows dirty reads, non-repeatable reads, and phantoms to occur.

QUESTION 70
When working with the InnoDB storage engine, which of the following correctly defines the READ COMMITTED
isolation level?

A. It allows a transaction to just see its committed changes.


B. It allows a transaction to see committed changes made by other transactions.
C. It allows a transaction to see uncommitted changes made by other transactions.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
29.4.5. InnoDB Isolation Levels, Multi-Versioning, and Concurrency
READ COMMITTED allows a transaction to see changes made by other transactions only if they've been
committed. Uncommitted changes remain invisible. This isolation level allows non-repeatable reads and
phantoms to occur.

QUESTION 71
Isolation levels can be set...

A. Per transaction
B. Per user name
C. Per session
D. Globally

Correct Answer: ACD


Section: (none)
Explanation

Explanation/Reference:
29.4.5. InnoDB Isolation Levels, Multi-Versioning, and Concurrency
The value of isolation_level should be READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ,
or SERIALIZABLE. The first form of the statement sets the server's global isolation level. It applies to all new
client connections established from that point on. Existing connections are unaffected. The second form sets
the isolation level for the current client connection only and applies to transactions the client performs from that
point on. The third form sets the isolation level only for the current client's next transaction.
1. SET GLOBAL TRANSACTION ISOLATION LEVEL isolation_level;
2. SET SESSION TRANSACTION ISOLATION LEVEL isolation_level;
3. SET TRANSACTION ISOLATION LEVEL isolation_level;

QUESTION 72
Which of the following are effects of defining foreign keys in InnoDB tables without specifying either ON
UPDATE or ON DELETE?

A. InnoDB will disallow foreign keys without specifying either ON UPDATE or ON DELETE.
B. InnoDB will disallow any delete or update on the primary key regardless if there is a corresponding child
record or not.
C. InnoDB will disallow any delete or update on the primary key on a parent record that may have
corresponding child records.
D. InnoDB will allow both deletes and updates on the primary key on a parent record even if they have
corresponding child records.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.4.6. Using Foreign Keys
The ON UPDATE and ON DELETE parts are optional. If you omit them, InnoDB simply disallows attempts to
update or delete Code values in the CountryParent table if there are CityChild records that refer to them.

QUESTION 73
Which of the following would be the effect of setting REFERENCES with ON UPDATE CASCADE?

A. Changes to the parent record would be disallowed if there were any corresponding child records.
B. Records could only be updated and not deleted regardless if they have any corresponding child records.
C. Changes made to the parent record are passed down to the corresponding child records.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
29.4.6. Using Foreign Keys
It specifies what actions to take if records are modified in the referenced table. The foreign key definition shown
specifies the CASCADE action for both UPDATE and DELETE operations. This means that changes in the parent
table are cascaded down to the child table. If you change a Code value in the CountryParent table, InnoDB
changes any corresponding CityChild records with that value in the CountryCode column to match. If you
delete a CountryParent record, InnoDB also deletes any CityChild records with the same country code.

QUESTION 74
Which of the following storage engines will ignore foreign keys if they are specified?

A. MyISAM
B. InnoDB
C. HEAP
D. MERGE
E. FEDERATED

Correct Answer: ACDE


Section: (none)
Explanation

Explanation/Reference:

QUESTION 75
When working with InnoDB, which of the following are true of a parent / child foreign key relationship?

A. The parent & child can have separate data types.


B. The parent & child must have the same data type.
C. The parent & child may sometimes need the same data type, but not always.
Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
29.4.6. Using Foreign Keys
In a foreign key relationship, the referring column and the referenced column should have the same data
type, and both must be indexed. (If the referring column has no index, InnoDB creates an index on it
automatically.)

QUESTION 76
When working with InnoDB, which of the following is true when trying to create foreign key references?

A. Only the child column must be indexed.


B. Only the parent column must be indexed.
C. Both the parent & child columns must be indexed.
D. InnoDB will not create an index automatically.
E. InnoDB may create an index automatically.

Correct Answer: CE
Section: (none)
Explanation

Explanation/Reference:
29.4.6. Using Foreign Keys
In a foreign key relationship, the referring column and the referenced column should have the same data type,
and both must be indexed. (If the referring column has no index, InnoDB creates an index on it
automatically.)

QUESTION 77
Which of the following statements are true for InnoDB?

A. InnoDB is enabled by default.


B. Tablespace and log files have to be configured explicitly to be created.
C. InnoDB is not enabled by default.
D. Tablespace and log files will be created even if not configured explicitly.

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
29.1. MySQL Storage Engines
For example, the InnoDB storage engine is included in all binary distributions. If you build MySQL from source,
InnoDB is included by default unless you specify the --without-innodb configuration option. For a server
that has the InnoDB storage engine included, support may be disabled at startup with the --skip-innodb
option.

29.4.7. Configuring and Monitoring InnoDB


A server that has InnoDB enabled uses a default configuration for its tablespace and log files unless you
provide configuration options.
29.4.7.1 Configuring the InnoDB Tablespace
If you don't specify any tablespace configuration options at all, InnoDB creates a shared tablespace consisting
of a single 10MB auto-extending regular file named ibdata1 in the data directory.

QUESTION 78
The my.cnf file contains the following entries:

innodb_data_home_dir =
innodb_data_file_path = /ibdata/ibdata1:50M;/disk2/ibdata2:50M:autoextend

Which of the following statements are true?

A. The data files will be stored below the default data directory
B. There are two InnoDB data files
C. There are three InnoDB data files
D. The total minimum size of the InnoDB data files is 100MB
E. The total maximum size of the InnoDB data files is 100MB
F. The initial size of the InnoDB data files on server startup will be set to 50MB. If more space is needed,
another 50MB will be allocated.

Correct Answer: BD
Section: (none)
Explanation

Explanation/Reference:
29.4.7.1 Configuring the InnoDB Tablespace

A tablespace consisting of a single 100MB file named innodata1 located in the data directory:

[mysqld]

innodb_data_file_path = innodata1:100M

It's unnecessary to specify a value for the innodb_data_home_dir option in this case because the data
directory is its default value.
A tablespace like that in the previous example, except that the file is auto-extending:

[mysqld]

innodb_data_file_path = innodata1:100M:autoextend

A tablespace like that in the previous example, but with a limit of 500MB on the size to which the auto-extending
file may grow:

[mysqld]

innodb_data_file_path = innodata1:100M:autoextend:max:500M

QUESTION 79
Which of the following are some general characteristics of the MEMORY storage engine?

A. Each table is represented on disk as a .frm file.


B. Each table has a corresponding .MYI and .MYD file.
C. They can support foreign keys.
D. They can not contain TEXT or BLOB columns
E. Table contents will not be saved if the server is restarted.
F. They can support transactions.

Correct Answer: ADE


Section: (none)
Explanation
Explanation/Reference:
29.5. The MEMORY Engine
The MEMORY storage engine manages tables that have the following characteristics:
Each MEMORY table is represented on disk by an .frm format file in the database directory. Table data and
indexes are stored in memory.
In-memory storage results in very fast performance.
MEMORY table contents do not survive a restart of the server. The table structure itself survives, but the table
contains zero data rows after a restart.
MEMORY tables use up memory (obviously), so they should not be used for large tables.
MySQL manages query contention for MEMORY tables using table-level locking. Deadlock cannot occur.
MEMORY tables cannot contain TEXT or BLOB columns.

QUESTION 80
Which of the following are true for how BTREE and HASH index types should be used for MEMORY tables?

A. HASH index types are only for use with equality comparisions such as those using the = and <=> operators.
B. BTREE index types are preferable for use with comparisons that do not just use equality operators such as
= and <=>
C. BTREE index types are only for use with equality comparisons such as those using the = and <=>
operators.
D. HASH index types are preferable for use with comparisons that do not just use equality operators such as =
and <=>

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
29.5.1. MEMORY Indexing Options
The MEMORY storage engine supports two indexing algorithms, HASH and BTREE:
MEMORY tables use hash indexes by default. This index algorithm provides very fast lookups for all
operations that use a unique index. However, hash indexes are usable only for comparisons that use the =
or <=> operator.
The BTREE index algorithm is preferable if the indexed column will be used with comparison operators other
than = or <=>. For example, BTREE can be used for range searches such as id < 100 or id BETWEEN
200 AND 300.

QUESTION 81
Which of the following statements are true for tables using the FEDERATED storage engine?

A. Each FEDERATED table is represented on disk by a .frm format file in the database directory of the local
server.
B. For each FEDERATED table, the content of the referenced table is stored in a .FED file on the local server.
C. The FEDERATED storage engine does not support transactions.
D. The FEDERATED storage engine supports transaction if the storage engine of the referenced table
supports transactions.
E. The FEDERATED storage engine supports SELECT statements.
F. The FEDERATED storage engine supports DELETE, UPDATE, and INSERT statements.

Correct Answer: ACEF


Section: (none)
Explanation

Explanation/Reference:
29.6. The FEDERATED Engine
The FEDERATED storage engine manages tables that have the following characteristics:
Each FEDERATED table is represented on disk only by an .frm format file in the database directory.
The FEDERATED storage engine does not support transactions.
The FEDERATED storage engine supports SELECT, DELETE, UPDATE, and INSERT statements.
MySQL does not use any locking for FEDERATED tables.

QUESTION 82
Besides specifying the column names and data types, which connection parameters may be defined when
defining a FEDERATED table?

A. The name and database of the referenced table


B. The host name of the server where the referenced table is located
C. The user name and password to be used to connect the remote server
D. The compression method to be used
E. The operating system of the remote server

Correct Answer: ABC


Section: (none)
Explanation

Explanation/Reference:
29.6. The FEDERATED Engine
Connection string format is as follows, where optional parts are shown in square brackets:
mysql://user_name[:password]@host_name[:port]/db_name/table_name

The username, password, hostname, and port number specify what connection parameters to use for
connecting to the remote server. The database and table names indicate which table to access on that server.

QUESTION 83
Which of the following are some general capabilites of the mysql client program?

A. Create and Drop databases.


B. Ping the server.
C. Create, Drop, and modify tables and indexes.
D. Shutdown the server.
E. Create users.
F. Display replication server status.

Correct Answer: ACEF


Section: (none)
Explanation

Explanation/Reference:
25.3. mysql
The mysql program is a general-purpose client that sends SQL statements to the server, and thus can perform
any administrative operation that can be expressed using SQL. The following list describes some of its
administrative capabilities:
Create and drop databases
Create, drop, and modify tables and indexes
Retrieve data from tables
Modify data in tables
Set up user accounts, grant and revoke privileges, and set passwords
Display server configuration and version information
Display or reset server status variables
Reload the grant tables
Flush the log files or various server caches
Start or stop replication slave servers or display replication status
Display information about client connections or kill connections

QUESTION 84
Which of the following are some general capabilities of the mysqladmin client program?

A. Ping the server


B. Shutdown the server.
C. Create users.
D. Create and drop databases.
E. Dump the contents of a table.
F. Set passwords.

Correct Answer: ABDF


Section: (none)
Explanation

Explanation/Reference:
25.4. mysqladmin
The mysqladmin command-line client is designed specifically for administrative operations. Its capabilities
include those in the following list:
"Ping" the server to see whether it's running and accepting client connections
Shut down the server
Create and drop databases
Display server configuration and version information
Display or reset server status variables
Set passwords
Reload the grant tables
Flush the log files or various server caches
Start or stop replication slave servers
Display information about client connections or kill connections

QUESTION 85
Which of the following are some general properties of the mysqlimport client program?

A. It loads data files into tables.


B. It can load files only on the server host.
C. It provides a command-line interface to the LOAD DATA INFILE.
D. It can load files both on the client and server host.
E. It bypasses the server and writes directly to the corresponding data files.

Correct Answer: ACD


Section: (none)
Explanation

Explanation/Reference:
25.5. mysqlimport
The mysqlimport client program loads data files into tables. It provides a command-line interface to the LOAD
DATA INFILE statement. That is, mysqlimport examines the options given on the command line. It then
connects to the server and, for each input file named in the command, issues a LOAD DATA INFILE
statement that loads the file into the appropriate table.

QUESTION 86
Which of the following is/are properties of the mysqldump client program?

A. It dumps table contents to a file.


B. It can put complete dump files on both the client and server host.
C. It can only dump files to the server host.
D. It bypasses the server and reads the corresponding data files directly.

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
25.6. mysqldump
The mysqldump client program dumps table contents to files. It is useful for making database backups or for
transferring database contents to another server. mysqldump can export tables as tab-delimited data files or
produce SQL-format dump files that contain CREATE TABLE and INSERT statements for re-creating the
dumped files.

QUESTION 87
Which of the following correctly defines the general difference between a read lock and a write lock?

A. A read lock allows other clients to read the same data, however will prevent any modification of the data
until the lock is released.
B. A read lock prevents any other client from reading the same data, until the lock is released.
C. A write lock only prevents any other client from modifying the locked data until the lock is released.
D. A write lock prevents any other client from reading or writing the locked data until the lock is released.

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
The following list describes the available lock types and their effects:

READ
Locks a table for reading. A READ lock locks a table for read queries such as SELECT that retrieve data
from the table. It does not allow write operations such as INSERT, DELETE, or UPDATE that modify the
table, even by the client that holds the lock. When a table is locked for reading, other clients can read
from the table at the same time, but no client can write to it. A client that wants to write to a table that is
read-locked must wait until all clients currently reading from it have finished and released their locks.

WRITE
Locks a table for writing. A WRITE lock is an exclusive lock. It can be acquired only when a table is not
being used. Once acquired, only the client holding the write lock can read from or write to the table. Other
clients can neither read from nor write to it. No other client can lock the table for either reading or writing.

QUESTION 88
Which of the following correctly describes the differences between explictly and implicitly set locks?

A. Implicitly set locks are locks set and released on behalf of the client, by the server.
B. Explicitly set locks are locks set and released on behalf of the client, by the server.
C. Implicitly set locks are locks acquired and released by the client.
D. Explicitly set locks are locks acquired and released by the client.

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
28.1. Locking Concepts
For a client that does nothing special to acquire locks, the MySQL server implicitly acquires locks as
necessary to process the client's statements safely.
If implicit locking is insufficient for a client's purposes, it can manage locks explicitly byacquiring them with
LOCK TABLES and releasing them with UNLOCK TABLES. Explicit locking may be necessary when a client
needs to perform an operation that spans multiple statements and that must not be interrupted by other
clients.

QUESTION 89
What are some properties of using LOCK TABLE?

A. Less work is required by the server to acquire and release locks.


B. It can only be used with the MyISAM storage engine.
C. Using LOCK TABLE sometimes decreases the amount disk reads and writes needed for a group of
statements.
D. All tables must be locked in a single statement.
E. It creates more disk activity.

Correct Answer: ACD


Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
An implicit lock lasts for the duration of a single query only, which is unsuitable should you want to perform a
multiple-statement update that requires no interference by other clients. To handle this, you can acquire an
explicit lock, which remains in effect until you release it. Other clients cannot modify tables that you have
locked.
Explicit locking can improve performance for multiple statements executed as a group while the lock is in
effect. First, less work is required by the server to acquire and release locks because it need not do so
for each statement. It simply acquires all needed locks at the beginning of the operation, and releases them
at the end. Second, for statements that modify data, index flushing is reduced. For example, if you execute
multiple INSERT statements using implicit locking, index flushing occurs following each statement. If you
lock the table explicitly and then perform all the inserts, index flushing occurs only once when you release
the lock. This results in less disk activity.

If you need to use multiple tables while holding an explicit lock, you must lock all of them at the same time
because you cannot use any unlocked tables while you hold explicit locks. Also, you must lock all the tables
with a single LOCK TABLES statement. LOCK TABLES releases any locks that you already hold, so you cannot
issue it multiple times to acquire multiple locks.

QUESTION 90
Which of the following describes how READ LOCAL locking works?

A. It locks a table for reading only by connections on localhost.


B. It locks a table for reading but allows concurrent inserts.
C. It locks a table for writing, preventing reads until it is released.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
READ LOCAL
Locks a table for reading, but allows concurrent inserts. A concurrent insert is an exception to the
"readers block writers" principle. It applies only to MyISAM tables. If a MyISAM table has no holes in the
middle resulting from deleted or updated records, inserts always take place at the end of the table. In that
case, a client that is reading from a table can lock it with a READ LOCAL lock to allow other clients to insert
into the table while the client holding the read lock reads from it. If a MyISAM table does have holes, you can
remove them by using OPTIMIZE TABLE to defragment the table.

QUESTION 91
Which of the following statements are true regarding table locks?

A. They can only be released by the client holding them.


B. They can be released by other connections than the client holding them.
C. They are implicitly released when the connection is closed.
D. They are not released when the connection is closed

Correct Answer: AC
Section: (none)
Explanation

Explanation/Reference:
28.2. Explicit Table Locking
Explicit locks held by a client also are released if the client issues another LOCK TABLES statement. Locks
cannot be maintained across connections; if a client has any unreleased locks when its connection to the
server terminates, the server implicitly releases its locks. An administrator with the SUPER privilege can
terminate a client connection with the KILL statement, which causes release of locks held by the client.
Only the client that holds a lock acquired with LOCK TABLES can release the lock. Another client cannot
release it. In other words, if you acquire a lock, it's yours until you give it up. Another client cannot force you to
release it.

QUESTION 92
The CHECK TABLE command should be used...

A. To make sure a table has no structural problems.


B. To find out why a query takes a long time to execute on a given table.
C. To make sure that no table data are corrupted.
D. to improve performance by updating index distribution statistics on InnoDB tables.
E. To repair table structure problems.

Correct Answer: ACD


Section: (none)
Explanation

Explanation/Reference:
30.2.1. CHECK TABLE
The CHECK TABLE statement performs an integrity check on table structure and contents. It works for
MyISAM and InnoDB tables. For MyISAM tables, it also updates the index statistics. If the table is a view,
CHECK TABLE verifies the view definition.
If the output from CHECK TABLE indicates that a table has problems, the table should be repaired.

QUESTION 93
The REPAIR TABLE command should be used...

A. To improve performance by updating index distribution statistics.


B. After multiple modifications to a tables data.
C. To correct problems with a MyISAM table that have become corrupted.
D. To check a tables structure to see if it may have been damaged and needs repair.
Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
30.2.2. REPAIR TABLE
The REPAIR TABLE statement corrects problems in a table that has become corrupted. It works only for
MyISAM tables.

QUESTION 94
The ANALYZE TABLE command should be used...

A. When you need to find out why a query is taking a long time to execute.
B. To improve performance by updating index distribution statistics.
C. After large amounts of table data have changed.
D. To check a tables structure to see if it may have been damaged and needs repair.

Correct Answer: BC
Section: (none)
Explanation

Explanation/Reference:
30.2.3. ANALYZE TABLE
The ANALYZE TABLE statement updates a table with information about the distribution of key values in
the table. This information is used by the optimizer to make better choices about query execution plans. This
statement works for MyISAM and InnoDB tables.

QUESTION 95
The OPTIMIZE TABLE command should be used...

A. To increase performance by defragmenting the table.


B. To improve performance by sorting indexes.
C. To improve performance by updating index statistics.
D. To correct problems with a MyISAM table that have become corrupted.
E. To check a tables structure to see if it may have been damaged and needs repair.

Correct Answer: ABC


Section: (none)
Explanation

Explanation/Reference:
30.2.4. OPTIMIZE TABLE
The OPTIMIZE TABLE statement cleans up a MyISAM table by defragmenting it. This involves reclaiming
unused space resulting from deletes and updates, and coalescing records that have become split and stored
non-contiguously. OPTIMIZE TABLE also sorts the index pages if they are out of order and updates the index
statistics.

QUESTION 96
The myisamchk command-line program must not be run on a set of tables if...

A. The server is running.


B. The server might access the same table files.
C. The server might access any tables in the same database.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
30.3. Client and Utility Programs for Table Maintenance
The myisamchk utility for MyISAM tables also performs table maintenance. However, it takes a different
approach from MySQL Administrator and mysqlcheck. Rather than sending SQL statements to the server,
myisamchk directly reads and modified the table files. For this reason, it's necessary when using myisamchk to
ensure that the server does not access the tables at the same time.The myisamchk utility for MyISAM tables
also performs table maintenance. However, it takes a different approach from MySQL Administrator and
mysqlcheck. Rather than sending SQL statements to the server, myisamchk directly reads and modified the
table files. For this reason, it's necessary when using myisamchk to ensure that the server does not
access the tables at the same time.

QUESTION 97
The CHECK TABLE command...

A. Will cause an error when used on MyISAM tables


B. Will cause an error when used on InnoDB tables
C. Will ignore MyISAM tables
D. Will ignore InnoDB tables
E. May be used to check both InnoDB and MyISAM tables

Correct Answer: E
Section: (none)
Explanation

Explanation/Reference:
30.2.1. CHECK TABLE
The CHECK TABLE statement performs an integrity check on table structure and contents. It works for
MyISAM and InnoDB tables. For MyISAM tables, it also updates the index statistics. If the table is a view,
CHECK TABLE verifies the view definition.

QUESTION 98
Which of the following steps should be taken to restore an InnoDB table to a consistent state without having to
shutdown the server?

A. Run the REPAIR TABLE command.


B. Dump the table with mysqldump, drop the table then re-create from the dump file.
C. Run the CHECK TABLE command.
D. Dump the table with mysqlhotcopy, drop the table then re-create with the backup file.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
30.4. Repairing InnoDB Tables
If a table check indicates that an InnoDB table has problems, you should be able to restore the table to a
consistent state by dumping it with mysqldump, dropping it, and re-creating it from the dump file:
shell> mysqldump db_name table_name > dump_file
shell> mysql db_name < dump_file

QUESTION 99
After a server crash, some InnoDB tables need to be repaired. However, when the server is restarted, auto-
recover failed. How would you repair the InnoDB tables?
A. Restart the server with the --innodb_force_recovery option.
B. Execute the REPAIR TABLE command.
C. Execute the OPTIMIZE TABLE command.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
30.4. Repairing InnoDB Tables
In rare cases, the server might not start up due to failure of InnoDB auto-recovery. If that happens, use the
following procedure: Restart the server with the --innodb_force_recovery option set to a value in the range
from 1 to 6. These values indicate increasing levels of caution in avoiding a crash, and increasing levels of
tolerance for possible inconsistency in the recovered tables. A good value to start with is 4. (...)

QUESTION 100
Suppose you have a server that has been started with the --myisam-recover option. When does the server
perform the check on the MyISAM tables?

A. Each time the server is started.


B. Each time it encounters an error.
C. Each time it opens the MyISAM table files.
D. Each time the CHECK TABLE command is issued.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
30.5. Enabling MyISAM Auto-Repair
The MySQL server can be instructed to check and repair MyISAM tables automatically. With automatic repair
enabled, the server checks each MyISAM table when it opens it to see whether the table was closed
properly the last time it was used and is not marked as needing repair. If the table is not okay, the server
repairs it. To enable automatic MyISAM table maintenance, start the server with the --myisam-recover option.

QUESTION 101
Will the following SELECT query list all of the tables in the INFORMATION_SCHEMA database? If not, why?

SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES


WHERE TABLE_SCHEMA = 'INFORMATION_SCHEMA'
ORDER BY TABLE_NAME

A. Yes.
B. No; the INFORMATION_SCHEMA database does not contain information on itself.
C. No; the WHERE clause is incorrect. The correct field name is TABLE_SCHEMATA.
D. No; there is no table in the INFORMATION_SCHEMA database called TABLES.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
20.2. Using INFORMATION_SCHEMA to Obtain Metadata
The INFORMATION_SCHEMA database serves as a central repository for database metadata. It is a "virtual
database" in the sense that it is not stored on disk anywhere, but it contains tables like any other database, and
the contents of its tables can be accessed using SELECT like any other tables. Furthermore, you can use
SELECT to obtain information about INFORMATION_SCHEMA itself.

QUESTION 102
Complete the following sentence.

The INFORMATION_SCHEMA.SCHEMATA table contains information about ...

A. ... the table structure for all databases.


B. ... all of the tables, triggers and views for every database.
C. ... all of the databases on the server, such as name, character set and collation.
D. ... every database's structure including tables, triggers, stored routines, views, etc.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
20.2. Using INFORMATION_SCHEMA to Obtain Metadata
The tables shown in that list contain the following types of information:
(...)
SCHEMATA
Information about databases
(...)

QUESTION 103
Consider the following query:

DELETE FROM INFORMATION_SCHEMA.TABLES


WHERE table_schema = 'world'
AND table_name = 'Country'

What would be the result of executing this query?

A. An error would be issued


B. A warning would be issued
C. The row would be deleted from the INFORMATION_SCHEMA.TABLES table, and the table Country would
be dropped from the world database
D. The row would be deleted from the INFORMATION_SCHEMA, but the table Country in the world database
would be unaffected.

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
20.2. Using INFORMATION_SCHEMA to Obtain Metadata
INFORMATION_SCHEMA is read-only. Its tables cannot be modified with statements such as INSERT,
DELETE, or UPDATE. If you try, an error occurs.

QUESTION 104
What are some advantages of using the INFORMATION_SCHEMA database rather than using the SHOW
command?

A. It is faster than using SHOW commands.


B. INFORMATION_SCHEMA is a feature of standard SQL, and SHOW is a MySQL specific command.
C. You always use SELECT to retrieve any of the metadata.
D. Using the INFORMATION_SCHEMA can provide more concise information.
E. The information returned from the INFORMATION_SCHEMA can be stored in other tables.

Correct Answer: BCE


Section: (none)
Explanation

Explanation/Reference:
20.1. Overview of Metadata Access Methods
SHOW and mysqlshow have been available since very early releases of MySQL. As of MySQL 5, metadata
access is enhanced through two additions:
The INFORMATION_SCHEMA database is implemented. This provides better compliance with standard SQL
because INFORMATION_SCHEMA is standard, not a MySQL-specific extension like SHOW.
(...)

20.2. Using INFORMATION_SCHEMA to Obtain Metadata


The INFORMATION_SCHEMA database serves as a central repository for database metadata. It is a "virtual
database" in the sense that it is not stored on disk anywhere, but it contains tables like any other database, and
the contents of its tables can be accessed using SELECT like any other tables.

When you retrieve metadata from INFORMATION_SCHEMA by using SELECT statements, you have the freedom
to use any of the usual SELECT features that you expect:
You can specify in the select list which columns to retrieve.
You can restrict which rows to retrieve by specifying conditions in a WHERE clause.
You can group or sort the results with GROUP BY or ORDER BY.
You can use joins, unions, and subqueries.
You can retrieve the result of an INFORMATION_SCHEMA query into another table with CREATE TABLE
... SELECT or INSERT ... SELECT. This enables you to save the result and use it in other statements
later.

QUESTION 105
What are some advantages of using the SHOW command rather than using the INFORMATION_SCHEMA?

A. It is available for releases older than MySQL 5.0.


B. It returns results quicker than using the INFORMATION_SCHEMA.
C. Using SHOW can provide more concise information.
D. SHOW is a feature of standard SQL, and INFORMATION_SCHEMA is a MySQL specific command.

Correct Answer: AC
Section: (none)
Explanation

Explanation/Reference:
20.1. Overview of Metadata Access Methods
SHOW and mysqlshow have been available since very early releases of MySQL. As of MySQL 5, metadata
access is enhanced through two additions:
The INFORMATION_SCHEMA database is implemented. This provides better compliance with standard SQL
because INFORMATION_SCHEMA is standard, not a MySQL-specific extension like SHOW.
SHOW statement syntax is extended to support a WHERE clause for describing which rows to display. (Some
SHOW statements support a LIKE clause for applying a pattern match to the rows of the result, but WHERE is
more flexible.)

QUESTION 106
Which of the following statements regarding the SHOW command and the INFORMATION_SCHEMA
database are true?
A. The INFORMATION_SCHEMA database exceeds the domain of information that the SHOW command can
provide.
B. The SHOW command exceeds the domain of information that the INFORMATION_SCHEMA database can
provide.
C. Both the SHOW command and the INFORMATION_SCHEMA provide the same domain of information.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
E. g. there is no SELECT * FROM INFORMATION_SCHEMA for SHOW ERRORS;

QUESTION 107
What three data components are needed for data recovery?

A. The slow log.


B. The backup log.
C. The general log.
D. The binary log.
E. The data backup.
F. configuration files.

Correct Answer: DEF


Section: (none)
Explanation

Explanation/Reference:

QUESTION 108
What are some general principles of making a good MySQL backup?

A. Enable the backup log.


B. Make backups regularly.
C. Enable the binary log.
D. Flush the logs after backup.
E. Never flush the logs.
F. Store your data directory and backup files on separate physical drives or locations.

Correct Answer: BCDF


Section: (none)
Explanation

Explanation/Reference:
32.1. Introduction to Data Backup and Recovery Methods
Here are some principles to keep in mind with regard to backups:
Make backups regularly.
Enable the binary log so that you have a record of changes made after a given backup.
Flush the logs when backing up so that the server will begin a new binary log file that corresponds to the
time of the backup. (That is, "checkpoint" the log to the backup.)
Store your data directory and your backups on different physical devices so that a device failure cannot
destroy both.
Include your backups in your normal filesystem backup procedures so that you can recover the backup if
necessary.
QUESTION 109
Which of the following are some trade-offs between binary and text backups?

A. Binary backups are faster while text backups are slower.


B. Binary backups are slower while text backups are faster.
C. Text backups are portable across different architectures.
D. Binary backups may not be portable across different architectures.

Correct Answer: ACD


Section: (none)
Explanation

Explanation/Reference:
32.3.4. Conditions for Binary Portability
MyISAM tables and InnoDB tablespaces are binary portable from one host to another if two conditions are met:
Both machines must use two's-complement integer arithmetic.
Both machines must use IEEE floating-point format, or else the tables must contain no floating-point
columns (FLOAT or DOUBLE).
In practice, those two conditions pose little restriction. Two's-complement integer arithmetic and IEEE floating-
point format are the norm on modern hardware.

QUESTION 110
Which of the following steps describe how to do a proper binary backup of MyISAM tables?

A. Always stop the server prior to the backup


B. Stop the server or lock the tables prior to the backup
C. Stop the server or lock the databases prior to the backup
D. Make a copy of the .frm, .MYD and the .MYI files.
E. Make a copy of the binary log and tablespace files

Correct Answer: BD
Section: (none)
Explanation

Explanation/Reference:
32.3.1. Making Binary MyISAM Backups
To make a binary backup of a MyISAM table, copy the .frm, .MYD, and .MYI files that MySQL uses to
represent the table. When you do this, the table must not be in use by other programs (including the server)
during the copy operation. If you stop the server while copying the table, there will be no problem of server
interaction. If you leave the server running, use an appropriate locking protocol to prevent server access to the
table. For example, to copy the Country table in the world database, lock the table and flush any pending
changes like this:

mysql> USE world;

mysql> LOCK TABLES Country READ;

mysql> FLUSH TABLES Country;

Then (with the table still locked) use your operating system's file copy command to copy the table files. After the
copy operation completes, release the lock on the table:

mysql> UNLOCK TABLES;

The preceding strategy works on Unix. On Windows, file-locking behavior is such that you might not be able to
copy table files for tables that are locked by the server. In that case, you must stop the server before copying
table files.

QUESTION 111
Which of the following steps describe how to do a proper binary backup of InnoDB data?

A. Stop the server prior to the backup


B. Stop the server or lock the tables prior to the backup
C. Make a copy of the .frm files.
D. Make a copy of the .MYD and .MYI files.
E. Make a copy of the InnoDB log and tablespace files.
F. Make a copy of any InnoDB configuration options.

Correct Answer: ACEF


Section: (none)
Explanation

Explanation/Reference:
32.3.2. Making Binary InnoDB Backups
To make an InnoDB binary backup, use the following procedure:

1. Stop the server for the duration of the copy operation. The tablespace must not be in use when copying the
tablespace files.

2. Make sure that the server shut down without error. Binary InnoDB backups require a clean shutdown to be
certain that the server has completed any pending transactions.

3. Make a copy of each of the following components:


The .frm file for each InnoDB table.
The tablespace files. This includes the files for the shared tablespace. It also includes the .ibd files if you
have configured InnoDB to use per-table tablespaces.
The InnoDB log files.
Any InnoDB configuration options, such as those stored in option files. The configuration options are
required in case you need to restore the backup from scratch. In that case, you'll need to know how the
tablespace and log files were created originally.

4. Restart the server.

QUESTION 112
Which of the following are requirements for MyISAM binary portability?

A. Both machines must use the same operating system.


B. Database and table names must use lowercase format.
C. Both machines must use IEEE floating-point format or contain no floating-point columns.
D. Both machines must use two's-complement integer arithmetic.

Correct Answer: BCD


Section: (none)
Explanation

Explanation/Reference:
32.3.4. Conditions for Binary Portability
MyISAM tables and InnoDB tablespaces are binary portable from one host to another if two conditions are met:
Both machines must use two's-complement integer arithmetic.
Both machines must use IEEE floating-point format, or else the tables must contain no floating-point
columns (FLOAT or DOUBLE).
In practice, those two conditions pose little restriction. Two's-complement integer arithmetic and IEEE floating-
point format are the norm on modern hardware.
A third condition for InnoDB binary portability is that you should use lowercase names for databases and
tables. This is because InnoDB stores these names internally (in its data dictionary) in lowercase on Windows.
Using lowercase names allows binary portability between Windows and Unix. To force the use of lowercase
names, you can put the following lines in an option file:

[mysqld]
lower_case_table_names=1

QUESTION 113
In order to use SELECT INTO OUTFILE backups, the output file

A. must be created afresh; can be viewed by the world; and will reside on the server
B. need not be created afresh; can be viewed by the world; and will reside on the server
C. must be created afresh; can not be viewed by the world; and will reside on the client or the server
D. need not be created afresh; can not be viewed by the world; and will reside on the server

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
15.2.2. Exporting Data with SELECT ... INTO OUTFILE
Use of INTO OUTFILE changes the operation of the SELECT statement in several ways:
The output produced by a SELECT INTO OUTFILE statement never leaves the server host. Instead of
sending the result over the network to the client, the server writes it to a file on the server host. To prevent
files from being overwritten, either accidentally or maliciously, the server requires that the output
file not already exist.
The statement causes the server to write a new file on the server host, so you must connect to the server
using an account that has the FILE privilege.
The file is created with filesystem access permissions that make it owned by the MySQL server but world-
readable.

Note
Any file created by INTO OUTFILE or INTO DUMPFILE is writable by all users on the server host. The reason
for this is that the MySQL server cannot create a file that is owned by anyone other than the user under whose
account it is running. (You should never run mysqld as root for this and other reasons.) The file thus must be
world-writable so that you can manipulate its contents.
http://dev.mysql.com/doc/refman/5.0/en/select-into.html

QUESTION 114
Which of the following statements is true for mysqldump?

A. It can dump data only on remote servers.


B. It can dump data only on the local server.
C. It can dump data on both local and remote servers.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
32.4.2. Making Text Backups with mysqldump
mysqldump can back up local or remote servers, although the destination for the dump files depends on how
you invoke it.

QUESTION 115
Which of the following is true of the mysqldump client program?

A. It can only backup tables from MyISAM.


B. It can only backup tables from InnoDB.
C. It can only backup tables from MyISAM and InnoDB.
D. It can backup tables from any of the available storage engines.

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
32.4.2. Making Text Backups with mysqldump
It works for tables created by any storage engine.

QUESTION 116
Using mysqldump, which of the following commands are used to backup one database?

A. shell> mysqldump world world.sql


B. shell> mysqldump world > world.sql
C. shell> mysqldump world < world.sql
D. shell> mysqldump -d world > world.sql

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
32.4.2. Making Text Backups with mysqldump
By default, mysqldump interprets its first non-option argument as a database name and dumps all the tables in
that database. If any other arguments follow the database name, mysqldump interprets them as table names
and dumps just those tables. The following command dumps the contents of all the tables in the world
database into a file named world.sql:

shell> mysqldump world > world.sql

QUESTION 117
Which of following list the default order in which option files are read on UNIX?

A. ~/.my.cnf, $MYSQL_HOME/my.cnf, and /etc/my.cnf


B. /etc/my.cnf, $MYSQL_HOME/my.cnf, and ~/.my.cnf
C. $MYSQL_HOME/my.cnf, /etc/my.cnf, and ~/.my.cnf
D. ~/.my.cnf, /etc/my.cnf, and $MYSQL_HOME/my.cnf
E. /etc/my.cnf, ~/.my.cnf, and $MYSQL_HOME/my.cnf

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
24.4. Runtime MySQL Configuration
On Unix, the search order includes two general option files, /etc/my.cnf and $MYSQL_HOME/my.cnf. The
second file is used only if the MYSQL_HOME environment variable is set. Typically, you set it to the MySQL
installation directory. (The mysqld_safe script attempts to set MYSQL_HOME if it is not set before starting the
server.)
The Unix option file search order also includes ~/.my.cnf, that is, the .my.cnf file located in the home
directory of the person running the program.

QUESTION 118
Which of the following are reasons to not just enable all logging?

A. Security risks.
B. More disk space is used.
C. More memory is used.
D. Slower performance.

Correct Answer: BD
Section: (none)
Explanation

Explanation/Reference:
35.4. Log Files and Security
Log exposure constitutes a security risk that must be addressed by protecting the log files, but logs also play a
role in enhancing security. Certain logs, if enabled, provide data security or information that is useful in the
event of attack:
The binary log is needed for data security. It's required for recovery operations should you need to restore
your databases (for example, if an attempt to compromise the server does succeed).
The general query log gives you information about what clients are connecting, which may be helpful in
detecting instances of malicious activity and determining their source. [Editor Comment: i. e. the general log
is actually a benefit for secrurity, while log exposure in general is a security risk.]

QUESTION 119
In which of the following locations can sample .cnf or .ini files be found in any distribution?

A. Below the MySQL data directory.


B. Below the MySQL installation directory.
C. /usr/share/mysql
D. c:\MySQL

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:

QUESTION 120
Which of the following statements best describe the purpose of the general query log and how you enable it?

A. The purpose is to record when a client connects or disconnects and record every SQL statement issued to
the server.
B. The purpose is to record SQL statements that are issued to the server for use when restoring backups.
C. The general query log is enabled with the --general-log or --general-log=file_name option.
D. The general query log is enabled with the --log or --log=file_name option.

Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
24.5.1. The General Query Log
The general query log contains a record of when clients connect and disconnect, and the text of every SQL
statement received by the server (whether or not it was processed successfully). The server writes statements
to the log in the order that it receives them. This log is useful for determining the frequency of a given type of
statement or for troubleshooting queries that are not logged to other log files.

To enable the general query log, use the --log or --log=file_name option. If no filename is given, the default
name is host_name.log, where host_name stands for the server hostname. By default, the server creates
the general query log file under the data directory unless you specify an absolute pathname.

QUESTION 121
Which two of the following statements best describe the purpose of the slow query log and how you enable it?

A. The slow log records the timestamps of when the server is performing slowly and when it is low on
resources.
B. The slow log records the text of all queries that exceed the long_query_time variable.
C. The slow log is enabled with the --log-slow-queries or --log-slow-queries=file_name option.
D. The slow log is enabled with the --log-slow or --log-slow=file_name option.

Correct Answer: BC
Section: (none)
Explanation

Explanation/Reference:
24.5.3. The Slow Query Log
The slow query log contains the text of queries that take a long time to execute, as well as information about
their execution status. By default, "a long time" is more than 10 seconds. This can be changed by setting the
long_query_time server variable. The server writes queries to this log after they finish because execution
time is not known until then.
To enable the slow query log, use the --log-slow-queries or --log-slow-queries=file_name option. If no
filename is given, the default name is host_name-slow.log, where host_name stands for the server
hostname.

QUESTION 122
Suppose you want queries that are not using indexes to be logged to the slow log. How would you enable this?

A. Use the --log-queries-indexes option.


B. Use the --log-slow-queries-indexes option.
C. Use the --log-queries-not-using-indexes option.
D. Use the --log-slow-queries-not-using-indexes option.

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
24.5.3. The Slow Query Log
To log queries that are not processed with the benefit of indexes, use the --log-queries-not-using-indexes
option.

QUESTION 123
Which of the following best describe what the mysql_tzinfo_to_sql script is needed for and how to use it?

A. The script is used to convert Unix-type timezone files into SQL statements that can be loaded.
B. The script is used to insert timezone files into MySQL.
C. shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
D. shell> /usr/share/zoneinfo mysql_tzinfo_to_sql | mysql -u root mysql
Correct Answer: AC
Section: (none)
Explanation

Explanation/Reference:
24.6. Loading Time Zone Tables
On operating systems that have their own time zone files, it is best to use them for loading the MySQL time
zone tables, to ensure that the system and MySQL time zones are based on the same information. Many Unix
systems have these files, often located under /usr/share/zoneinfo. For such systems, use the
mysql_tzinfo_to_sql program to convert the file contents into SQL statements that can be loaded into MySQL
by the mysql program. If the files are located at /usr/share/zoneinfo, the command looks like this:

shell> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

QUESTION 124
Which of the following steps should be performed in order to secure a MySQL server freshly installed from a
binary tarball.

A. All initial accounts should have passwords set and unused accounts should be removed.
B. The MySQL server should be set to run as it's own user, not as an administrative account.
C. The data directory and it's contents should be strictly accessible only to the user MySQL runs as.
D. The server should be started with the mysqld_secure script.

Correct Answer: ABC


Section: (none)
Explanation

Explanation/Reference:
35.3. Filesystem Security
After you've established the proper filesystem access so that the mysql login account owns the relevant
directories and files, the MySQL server should be run using this account. This is important because mysql is a
regular login account that has no special filesystem privileges.
The server should not be run as the system root user. There are many reasons for this; one is that there
are operations performed by the server that involve reading or writing files in the server host filesystem. (For
example, LOAD DATA INFILE and SELECT INTO OUTFILE do so.) Running the server as root is a bad
idea because doing so gives it root privileges and vastly increases the extent of the filesystem that the server
can access or modify.

35.5.1. Securing the Initial MySQL Accounts


The initial MySQL accounts have no password by default. You should assign a password immediately to any
root accounts to prevent other people from connecting to the server as root and gaining complete control
over it.
On Unix, MySQL comes with a mysql_secure_installation script that can perform several helpful security-
related operations on your installation. [Editor Comment: there is no script called mysql_secure.]
35.5.2. General Privilege Precautions
Make sure that all MySQL accounts have passwords.

QUESTION 125
Which of the following are true with regards to the server SQL mode?

A. The server SQL mode determines how the server should behave when performing data validation checks
and interpreting different forms of syntax.
B. The server SQL mode determines whether the server should be read-only or accept commands such as
INSERT, UPDATE, etc.
C. The default SQL mode can be set by adding a mode="" to the [mysqld] section of a server option file.
D. The SQL mode can be changed at the session level with a SET SESSION sql_mode="" command.
Correct Answer: AD
Section: (none)
Explanation

Explanation/Reference:
1.3. Server SQL Modes
Many operational characteristics of MySQL Server can be configured by setting the SQL mode. This mode
consists of optional values that each control some aspect of query processing. By setting the SQL mode
appropriately, a client program can instruct the server how strict or forgiving to be about accepting input data,
enable or disable behaviors relating to standard SQL conformance, or provide better compatibility with other
database systems.
The SQL mode is controlled by means of the sql_mode system variable.
---
Sie knnen den SQL-Modus zur Laufzeit mithilfe der Anweisung SET [GLOBAL|SESSION] sql_mode='modes'
zur Einstellung des Systemwertes sql_mode ndern.
http://dev.mysql.com/doc/refman/5.1/de/server-sql-mode.html

QUESTION 126
Which of the following should be done before upgrading the mysql server to a newer version?

A. Read and understand the appropriate "Upgrading MySQL" section of the online manual.
B. Read through the online change notes and understand the changes made between the versions.
C. Prepare the datadir to be read in by a new version by running the mysqlupgrade --prepare command on it.
D. Nothing; MySQL data files are binary compatible between all versions and the server will automatically
perform any conversions needed.

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
24.9. Upgrading MySQL
Check the MySQL Reference Manual before performing any upgrade:
Always consult the section on upgrading to see whether there are any notes pertaining to the type of
upgrade you're performing. If so, follow the recommended procedures described there.
Check the change note sections for versions more recent than your current version to make sure that you're
aware of what has changed since your original install. Note particularly any changes that are not backward
compatible with your current version because they may require modifications to your existing applications if
you upgrade.

QUESTION 127
When you upgrade from one version of MySQL to another which of these steps are considered necessary?

A. Check the MySQL Reference Manual upgrading section and read the parts that concern your upgrade
B. Backup your databases
C. Stop the MySQL server
D. Install the new version of MySQL on top of the existing version
E. Start the new server
F. None of the above

Correct Answer: ABCDE


Section: (none)
Explanation

Explanation/Reference:
24.9. Upgrading MySQL
Check the MySQL Reference Manual before performing any upgrade.
Despite those cautionary remarks, upgrading MySQL usually is straightforward and can be done using the
following procedure:
Back up your databases.
Stop the server.
Install the new version of MySQL on top of the existing version.
Start the new server.

QUESTION 128
mysqldump can be instructed to include commands to drop and recreate tables before trying to create or load
data.

A. True
B. False

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
32.4.2. Making Text Backups with mysqldump
--add-drop-table
Instructs mysqldump to precede the dump output for each table with a DROP TABLE statement that drops the
table. This option ensures that when you reload the dump output, the reload operation removes any existing
copy of the table before re-creating it.

QUESTION 129
Which of the following best describe a replication setup with regard to backup procedures?

A. 24 by 7 operations can be maintained but backups may not consist of a full snapshot
B. 24 by 7 operations can be maintained but may be halted at backup time.
C. 24 by 7 operations can be maintained without interruptions.
D. 24 by 7 operations can be maintained with backups from a slave server.
E. 24 by 7 operations can be maintained with a slave being the "hot spare".
F. none of the above.

Correct Answer: CDE


Section: (none)
Explanation

Explanation/Reference:
32.6. Replication as an Aid to Backup
The advantage of making a backup this way is that it doesn't take place on the master server. Thus, the
master need not be interrupted at all, and the backup procedure does not impose any extra disk or
processing load on it.

QUESTION 130
When backing up a replication slave, which of the following replication files should also be backed up?

A. The master.info file


B. Any relay logs
C. The relay index
D. The world db file
E. The replication world file
F. None of the above
Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
32.5. Backing Up Log and Status Files
Replication slave servers create a master.info file that contains information needed for connecting to the
master server, and a relay-log.info file that indicates the current progress in processing the relay logs.

QUESTION 131
Assume you created a backup of the world database by the following statement.

shell> mysqldump --opt world > dump.sql

How can you import the data from this dumped file into the test database?

A. shell> mysql test < dump.sql


B. shell> mysqladmin recover test dump.sql
C. mysql> USE test;mysql> SOURCE dump.sql;
D. mysql> RECOVER test dump.sql;

Correct Answer: AC
Section: (none)
Explanation

Explanation/Reference:
32.8.1. Reloading mysqldump Output
To reload an SQL-format dump file produced by mysqldump, process it with mysql. For example, you might
have made a copy of the Country table in the world database with this command:
shell> mysqldump world Country > dump.sql
To reload the file later, use mysql:
shell> mysql world < dump.sql

2.5. Using Script Files with mysql


One way to process a script file is by executing it with a SOURCE command from within mysql:
mysql> SOURCE input_file;

QUESTION 132
You have created a dump using mysqldump with the --extended-insert option. Will you be able to use this dump
on any MySQL server instance?

A. Always
B. Yes, provided that --max-allowed-packet is set correctly
C. Yes, provided that binary logging is turned off during the re-reading of the dump.
D. No, the new server instance must be the same version as the one which created the dump for everything to
work

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
32.8.1. Reloading mysqldump Output
If a dump file contains very long INSERT statements, they might exceed the default size of the communications
buffer (1MB). You can increase the buffer size for both mysqldump and mysql with the --max-allowed-packet
option. The option value may be given in bytes or followed by K, M, or G to indicate a size in kilobytes,
megabytes, or gigabytes. For example, --max-allowed-packet=32M specifies a size of 32MB. The server also
must be run with a --max-allowed-packet value that increases its own communications buffer to be large
enough.

QUESTION 133
The MySQL server host crashes at 10:00 in the morning, and is brought back online at 10:30. In order to
ensure that all data are consistent, a copy is first made of the table, tablespace and log files currently on the
server host, and these files are then restored from a backup made at 03:00 the same morning. What should be
done in order to bring the database to the state it was at just before the server host crashed?

A. The mysql_restore utility should be used to update the server to its last known state.
B. The binary logs recorded after the backup at 03:00 should be re-applied to make the database file
consistent with the state just before the crash.
C. The procedure described is wrong; instead, the mysqlcheck utility should be used and only if that fails
should backup copies be restored.
D. Once the backup files from 03:00 have been restored, there is nothing more that can be done to restore the
database files.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:

QUESTION 134
Consider the three binary log files bin.00010, bin.00011 and bin.00012 which you want to restore data from.
How should you process these files when using mysqlbinlog to satisfy inter-file dependencies?

A. shell> mysqlbinlog bin.00010 | mysqlshell> mysqlbinlog bin.00011 | mysqlshell> mysqlbinlog bin.00012 |


mysql
B. shell> mysqlbinlog bin.00010 bin.00011 bin.00012 | mysql
C. You can use both of the above statements, i.e. process the files either in a group or separately.
All inter-file dependencies will be taken care of with both methods.

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
32.8.3. Processing Binary Log Contents

shell> mysqlbinlog bin.000050 bin.000051 bin.000052 | mysql

All the binary log files that you want to process should be handled in a single mysqlbinlog command. There
may be inter-file dependencies that will not be satisfied if you process them separately.

QUESTION 135
Consider the available command line options of mysqlbinlog. Which of the following statements are true?

A. --start-position will read the binlog entries starting at the specified position
B. --end-position will read the binlog entries up to the specified position
C. --start-datetime will read the binlog entries starting at the specified date and time
D. --end-datetime will read the binlog entries up to the specified date and time
E. --start-file will read the binlog entries starting with the specified filename
F. --end-file will read the binlog entries ending after the specified filename
Correct Answer: ABCD
Section: (none)
Explanation

Explanation/Reference:
32.8.3. Processing Binary Log Contents
To handle partial-file extraction, mysqlbinlog supports options that enable you to specify the time or log
position at which to begin extracting log contents:
The --start-datetime option specifies the date and time at which to begin extraction, where the option
argument is given in DATETIME format.
The --start-position option can be used to specify extraction beginning at a given log position.
There are also corresponding --stop-datetime and --stop-position options for specifying the point
at which to stop extracting log contents.

QUESTION 136
Which of the following SQL constructs are not available with all storage engines, i.e. which are storage engine
dependent?

A. BEGIN and ROLLBACK have an effect only for tables managed by transactional storage engines, such as
InnoDB.
B. Some index types are available only for particular storage engines. For example, only the MyISAM engine
supports full-text or spatial indexes.
C. LOAD DATA INFILE only works for tables managed by disk based storage engines, such as InnoDB or
MyISAM.
D. OPTIMIZE TABLE only works for tables managed by storage engines that perform table level locking, such
as MyISAM.

Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:
30.2.4. OPTIMIZE TABLE
The OPTIMIZE TABLE statement cleans up a MyISAM table by defragmenting it. This involves reclaiming
unused space resulting from deletes and updates, and coalescing records that have become split and stored
non-contiguously. OPTIMIZE TABLE also sorts the index pages if they are out of order and updates the index
statistics.
OPTIMIZE TABLE also works for InnoDB tables, but maps to ALTER TABLE, which rebuilds the table. This
updates index statistics and frees space in the clustered index.

QUESTION 137
Which of the following are true regarding the key buffer cache?

A. The key buffer is used for caching index blocks for MyISAM tables.
B. The key buffer is used for caching index blocks for all MySQL tables.
C. Setting the buffer to a larger size will generally increase performance.
D. Setting the buffer to a larger size will generally decrease performance.

Correct Answer: AC
Section: (none)
Explanation

Explanation/Reference:
23.5. How MySQL Uses Memory
The server uses several buffers (caches) to hold information in memory for the purpose of avoiding disk access
when possible.
A key buffer holds index blocks for MyISAM tables. By caching index blocks in memory, the server often can
avoid reading index contents repeatedly from disk for index-based retrievals and other index-related operations
such as sorts.

37.4. MyISAM Index Caching


The key cache improves performance by reducing the need to read index blocks from disk each time they are
accessed.

QUESTION 138
Which of the following are true regarding the table cache?

A. It is used to cache row data in open tables.


B. It holds file descriptors for open tables.
C. The size of the table cache may be set per-session
D. Each connection has its own table cache. They are of equal size, set globally.
E. There is one table cache, shared among all sessions.
F. Increasing the size of the variable table_cache allows mysqld to keep more tables open simultaneously.

Correct Answer: BEF


Section: (none)
Explanation

Explanation/Reference:
39.3.1. Global (Server-Wide) Parameters
This section discusses server parameters for resources that affect server performance as a whole or that are
shared among clients.
The table cache that holds information about tables that storage engines have open.

39.3.1.2 The Table Cache


When the server opens a table, it maintains information about that table in the table cache, which is used to
avoid reopening tables when possible.

Against this goal you must balance the fact that with a larger table cache the server requires more file
descriptors. Operating systems place a limit on the number of file descriptors allowed to each process, so the
table cache cannot be made arbitrarily large. However, some operating systems do allow the per-process file
descriptor limit to be reconfigured.

QUESTION 139
In which of the following files must the base directory be specified if MySQL is not installed in the default
directory for the platform?

A. config.cnf
B. config.ini
C. my.cnf
D. my.ini
E. basedir.cnf
F. basedir.ini

Correct Answer: CD
Section: (none)
Explanation

Explanation/Reference:
24.4. Runtime MySQL Configuration
If you install MySQL on Windows, the server assumes by default that the installation directory is C:\mysql and
the data directory is named data in the installation directory. If you install MySQL somewhere else, such as E:
\mysql, you must tell the server that location with a --basedir option. Options in option files are given
without the leading dashes, so to indicate the installation directory, specify the option as follows:

[mysqld]

basedir=E:/mysql

http://www.gratisexam.com/

S-ar putea să vă placă și