mysqladmin - Client for Administering a MySQL Server

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.

Check server status

[email protected]:~$ mysqladmin -u joseph -p status

or use the extended-status option

[email protected]:~$ mysqladmin -u joseph -p extended-status

Check runtime server variables

[email protected]:~$ mysqladmin -u joseph -p variables
Enter password:
+----------------------------------------------------------+------+
| Variable_name | Value |
+----------------------------------------------------------+------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| autocommit | ON

Shutdown the server

[email protected]:~$ mysqladmin -u joseph -p shutdown

Show version of the server

[email protected]:~$ mysqladmin -u joseph -p version

Start replication on the slave

[email protected]:~$ mysqladmin -u joseph -p start-slave

Stop replication on the slave

[email protected]:~$ mysqladmin -u joseph -p stop-slave

Reload grant tables

[email protected]:~$ mysqladmin -u joseph -p reload

Flush all tables and close and open log files

[email protected]:~$ mysqladmin -u joseph -p refresh

Show a list of active threads(clients).

[email protected]:~$ mysqladmin -u joseph -p processlist
Enter password:
+----+--------+-----------+-------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+--------+-----------+-------+---------+------+----------+------------------+
| 5 | joseph | localhost | mysql | Sleep | 8299 | | |
| 21 | joseph | localhost | | Query | 0 | starting | show processlist |
+----+--------+-----------+-------+---------+------+----------+------------------+

Change user password

[email protected]:~$ mysqladmin --verbose -u joseph -p password
Enter password:
New password:
Confirm new password:

Kill server thread(client)

First find the process id or pid

[email protected]:~$ mysqladmin --verbose -u joseph -p processlist
Enter password:
+----+--------+-----------+-------+---------+------+----------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+--------+-----------+-------+---------+------+----------+-----------------------+
| 5 | joseph | localhost | mysql | Sleep | 8551 | | |
| 27 | joseph | localhost | | Query | 0 | starting | show full processlist |
+----+--------+-----------+-------+---------+------+----------+-----------------------+

and then kill the process

[email protected]:~$ mysqladmin --verbose -u joseph -p kill 5

Reload grant privileges tables

[email protected]:~$ mysqladmin --verbose -u joseph -p flush-privileges

Flush log files

[email protected]:~$ mysqladmin --verbose -u joseph -p flush-logs

Flush all tables

[email protected]:~$ mysqladmin --verbose -u joseph -p flush-tables
Enter password:

notice, no more open tables after flushing the table cache

[email protected]:~$ mysqladmin --verbose -u joseph -p status
Enter password:
Uptime: 13065 Threads: 2 Questions: 11773 Slow queries: 0 Opens: 745 Flush tables: 2 Open tables: 0 Queries per second avg: 0.901

Flush the thread cache

[email protected]:~$ mysqladmin --verbose -u joseph -p flush-threads

results matching ""

    No results matching ""