MySQL Conference

O’Reilly Media will be hosting the MySQL Conference in Santa Clara, California: April 12 - 15, 2010.

MySQueaL Resources

resources for mysql admins and developers who are squealing for help
site last updated:
04 mar. 2010 - 10:45:30 am


1647 hits past day

MySQL Table & Server Administration Statements

This section of our documentation of MySQL explains SQL statements for administering of MySQL databases (e.g., REPAIR TABLE and SHOW PROCESSLIST).

Related SQL Statements

Below are MySQL statements related to the SQL topic selected.

BACKUP TABLE

This MySQL statement makes a backup copy of a MyISAM table. However, it has been deprecated because it does not work reliably.

CACHE INDEX

This MySQL statement tells MySQL to cache the given indexes to a specific index cache, which can be created with the SET GLOBAL statement. This MySQL statement is used only on MyISAM tables.

CHECKSUM TABLE

This MySQL statement returns a MyISAM table's live checksum value, a value that can be optionally maintained to improve a table's repairability.

KILL

Use this MySQL statement to terminate a client connection to MySQL. You can use the SHOW PROCESSLIST statement to obtain a connection thread identifier for use in this statement.

RESET

Use this MySQL statement to reset certain server settings and files. It's similar to the FLUSH statement, but more powerful for its specific uses.

RESTORE TABLE

This MySQL statement restores a table that was saved to the filesystem by the BACKUP TABLE statement, which is deprecated.

SET

This MySQL statement sets a system or user variable for global or session use.

FLUSH

Use this MySQL statement to clear temporary caches in MySQL.

LOCK TABLES

Use this MySQL statement to lock the given tables for exclusive use by the current connection thread. There are a few different types of locks that may be used: one allow users to continue to retrieve data, but not change data; another locks all other users out, totally.

UNLOCK TABLES

Use this MySQL statement to unlock tables that were locked by the current connection thread with the LOCK TABLES statement.

ANALYZE TABLE

Use this MySQL statement to store information that can be useful later when the MySQL optimizer chooses the order for consulting indexes during a query.

CHECK TABLE

Use this MySQL statement to check tables for errors; as of version 5.1.9 of MySQL, it works with the MyISAM, InnoDB, ARCHIVE, and CSV storage engines. If errors are discovered, you should run the REPAIR TABLE statement to repair the table.

OPTIMIZE TABLE

Use this MySQL statement to optimize the data contained in a table. Optimization is useful when many rows have been deleted from a table. It's also useful to run this statement periodically with a table that contains several variable-character-width columns (i.e., VARCHAR, BLOB, and TEXT columns)

REPAIR TABLE

Use this MySQL statement to repair corrupted MyISAM tables.

SHOW SCHEMAS

This MySQL statement is synonymous with SHOW DATABASES. See the description of that statement for more information and examples.

SHOW TABLE STATUS

This MySQL statement displays status information on a set of tables from a database.

SHOW ENGINE

Use this MySQL statement to display details of the status of a given storage engine. This statement provides information on table and record locks for transactions, waiting locks, pending requests, buffer statistics and activity, and logs related to the engine.

SHOW ENGINES

Use this MySQL statement to list the storage engines (types of tables) available for the installation of MySQL you're using.

SHOW OPEN TABLES

Use this MySQL statement to display a list of tables that are open; that is to say, in the table cache. The list does not include any temporary tables.

SHOW PLUGINS

Use this MySQL statement to display a list of plugins on the server.

SHOW STATUS

This MySQL statement displays status information and variables from the server.

SHOW TABLE STATUS

This MySQL statement displays status information on a set of tables from a database.

SHOW VARIABLES

This MySQL statement displays the system variables for the MySQL server.

SHOW PROCESSLIST

This statement displays a list of connection threads running on the MySQL server. You'll need this if one of them is locked and slowing down the system.

Related Functions

Below are MySQL functions related to the SQL topic selected.

CONNECTION_ID( )

This MySQL function returns the MySQL connection or thread identification number for the MySQL session.

GET_LOCK( )

This MySQL function attempts to get a lock on the name given in the first argument.

IS_FREE_LOCK( )

Use this MySQL function to determine whether the name of the lock given in parentheses is free and available as a lock name.

IS_USED_LOCK( )

This MySQL function determines whether the name given is already in use as a lock name.

RELEASE_LOCK( )

This MySQL function releases a lock created by GET_LOCK().

Return to previous page of our MySQL Documentation
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (San Nazaro Basilica, Milan, Italy)

special notices

Color Highlights

When you look at SQL statements and functions on the pages for some sections of our documentation for MySQL, you may notice that some are shown in a different color (light blue at the moment). What we've done is set up a log to keep track of which pages of our documentation readers view. From there, our script every few minutes determines the most popular statements and functions and changes the colors of the links to those pages.

Need Math Examples

Although we did well in math classes all through school, we have very little experience with the Math Functions of MySQL very little. As a result, we don't have very good examples for them. If you work in science or engineering and have some ideas for easy to understand examples that we can add, please tell us.