mysqladmin is a client for performing administrative operations. You can use it to check the server’s configuration and current status, to create and drop databases, and more.

Invoke mysqladmin like this:

 shell> mysqladmin [options] command [command-arg] [command [command-arg]] …

Some of the commands take an argument following the command name.

* ping

Check whether the server is available.

#mysqladmin -u root –p password ping

mysqld is alive

* password new-password

Set a new password. This changes the password to new-password for the account that you use with mysqladmin

#mysqladmin -u root -p password password newpass

 * reload

Reload the grant tables.

#mysqladmin -u root -p password reload


Flush all tables and close and open log files.

#mysqladmin -u root -p password refresh


Stop the server.

#mysqladmin -u root -p password shutdown


Display the server system variables and their values.(max_connections,slow_query_log, etc etc)

#mysqladmin -u root -p password variables


#mysqladmin -u root -p password var


Display version information from the server.

#mysqladmin -u root –p password version

mysqladmin  Ver 8.42 Distrib 5.1.45, for redhat-linux-gnu on i386

Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL license

Server version 5.1.45

Protocol version 10


Display a short server status message.

#mysqladmin -u root -p password status


#mysqladmin -u root -p password stat

Uptime: 12442  Threads: 1  Questions: 48  Slow queries: 0  Opens: 16  Flush tables: 2  Open tables: 0  Queries per second avg: 0.3

* processlist

Show a list of active server threads.

#mysqladmin -u root -p password processlist


#mysqladmin -u root -p password proc


| Id | User | Host         | db | Command | Time | State | Info                       |

+—+——  +———–—+——+—————-+——–+———+————————-+

| 27 | root | localhost  |       | Query        | 0       |          | show processlist  |


* Process list & status

#mysqladmin -u root -p password proc stat


| Id | User | Host      | db | Command | Time | State | Info             |


| 37 | root | localhost |    | Query   | 0    |       | show processlist |


Uptime: 13133  Threads: 1  Questions: 62  Slow queries: 0  Opens: 16  Flush tables: 2  Open tables: 0  Queries per second avg: 0.4

 Uptime – The number of seconds the MySQL server has been running.

Threads – The number of active threads (clients).

Questions – The number of questions (queries) from clients since the server was started.

Slow queries – The number of queries that have taken more than long_query_time seconds. See Section 5.2.5, “The Slow Query Log”.

Opens – The number of tables the server has opened.

Flush tables – The number of flush-*, refresh, and reload commands the server has executed.

Open tables – The number of tables that currently are open.

Memory in use – The amount of memory allocated directly by mysqld.

Maximum memory used – The maximum amount of memory allocated directly by mysqld.

* create db_name

Create a new database named  ”newdb”.

#mysqladmin -u root -p password create newdb

*drop db_name

Delete the database named  ”newdb” and all its tables.

# mysqladmin -u root -p password drop newdb

Dropping the database is potentially a very bad thing to do.Any data stored in the database will be destroyed.

Do you really want to drop the ‘newdb’ database [y/N] y

Database “newdb” dropped

* extended-status

Display the server status variables and their values.

# mysqladmin -u root -p password extended-status


# mysqladmin -u root -p password ex

* No: of threads connected

# mysqladmin -u root -p password ex | grep Threads_connected

| Threads_connected                 | 1        |

* flush-hosts

Flush all information in the host cache.

# mysqladmin -u root -p password flush-hosts

* flush-logs

Flush all logs.

# mysqladmin -u root -p password flush-logs

* flush-privileges

Reload the grant tables (same as reload).

# mysqladmin -u root -p password flush-privileges

* flush-status

Clear status variables.

#mysqladmin -u root -p password flush-status

* flush-tables

Flush all tables.

#mysqladmin -u root -p password flush-tables

* flush-threads

Flush the thread cache.

#mysqladmin -u root -p password flush-threads

* kill id,id,…

Kill server threads. If multiple thread ID values are given, there must be no spaces in the list.

#mysqladmin -u root -p password kill 19

Posted in: Linux.
Last Modified: October 24, 2013

Leave a reply