A 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 | Set a new password. Change old password to new-password. |
ping | Check if mysqld is alive. |
processlist | Show list of active threads in server, as with the SHOW PROCESSLIST statement. If the --verbose option is given, the output is like that of SHOW FULL PROCESSLIST. |
reload | Reload grant tables. |
refresh | Flush all tables and close and open log files. |
shutdown | Take down the server. |
slave-start | Start slave replication thread. |
slave-stop | Stop slave replication thread. |
status | Gives a short status message from the server. |
variables | Prints variables available. |
version | Get version information 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:
Column | Description |
Uptime | Number of seconds the MySQL server has been up. |
Threads | Number of active threads (clients). |
Questions | Number of questions from clients since mysqld was started. |
Slow queries | Queries that have taken more than long_query_time seconds. See Slow query log. |
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=full). |
Max memory used | Maximum memory allocated directly by the mysqld code (only available when MySQL is compiled with --with-debug=full). |
If you do mysqladmin shutdown on a socket (in other words, on a the computer where mysqld is running), mysqladmin will wait until the MySQL pid-file is removed to ensure that the mysqld server has stopped properly.