MysqlAdmin commands

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


About Manish Jha

Hi All I am Manish Kumar Jha aka Alex Hunt. I am currently working in Iono,Inc as Cloud Solutions Architect. I have around 8 Years of IT experience and have exposure on VMware vSphere, vCloud Director, RHEL and modern data center technologies like Cisco UCS and Cisco Nexus 1000v and NSX. If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post. Disclaimer: All the information on this website is published in good faith and for general information purpose only. I don’t make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this blog is strictly at your own risk. The Views and opinions published on this blog are my own and not the opinions of my employer or any of the vendors of the product discussed.
This entry was posted in Linux/CentOS. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s