12.2 Administrer un serveur MySQL

Utility for performing administrative operations. The syntax is:

shell> mysqladmin [OPTIONS] command [command-option] command ...

You can get a list of the options your version of mysqladmin supports by executing mysqladmin --help.

The current mysqladmin supports the following commands:

create databasename Create a new database.
drop databasename Delete a database and all its tables.
extended-status Gives an extended status message from the server.
flush-hosts Flush all cached hosts.
flush-logs Flush all logs.
flush-tables Flush all tables.
flush-privileges Reload grant tables (same as reload)
kill id,id,... Kill mysql threads.
password new-password Change old password to new-password
ping Check if mysqld is alive
processlist Show list of active threads in server
reload Reload grant tables
refresh Flush all tables and close and open logfiles
shutdown Take server down
status Gives a short status message from the server
variables Prints variables available
version Get version info from server

All commands can be shortened to their unique prefix. For example:

shell> mysqladmin proc stat
| Id | User  | Host      | db | Command     | Time | State | Info |
| 6  | monty | localhost |    | Processlist | 0    |       |      |
Uptime: 10077  Threads: 1  Questions: 9  Slow queries: 0  Opens: 6  Flush tables: 1  
Open tables: 2  Memory in use: 1092K  Max memory used: 1116K

The mysqladmin status command result has the following columns:

Uptime Number of seconds the MySQL server have been up
Threads Number of active threads (clients)
Questions Number of questions from clients since mysqld was started
Slow requêtes@tab Requêtesthat has taken more than long_query_time seconds
Opens How many tables mysqld has opened.
Flush tables Number of flush ..., refresh and reload commands.
Open tables Number of tables that are open now
Memory in use Memory allocated directly by the mysqld code (only available when MySQL is compiled with --with-debug)
Max memory used Maximum memory allocated directly by the mysqld code (only available when MySQL is compiled with --with-debug)