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
joseph@ubuntu:~$ mysqladmin -u joseph -p status
or use the extended-status
option
joseph@ubuntu:~$ mysqladmin -u joseph -p extended-status
Check runtime server variables
joseph@ubuntu:~$ mysqladmin -u joseph -p variables
Enter password:
+----------------------------------------------------------+------+
| Variable_name | Value |
+----------------------------------------------------------+------+
| auto_increment_increment | 1 |
| auto_increment_offset | 1 |
| autocommit | ON
Shutdown the server
joseph@ubuntu:~$ mysqladmin -u joseph -p shutdown
Show version of the server
joseph@ubuntu:~$ mysqladmin -u joseph -p version
Start replication on the slave
joseph@ubuntu:~$ mysqladmin -u joseph -p start-slave
Stop replication on the slave
joseph@ubuntu:~$ mysqladmin -u joseph -p stop-slave
Reload grant tables
joseph@ubuntu:~$ mysqladmin -u joseph -p reload
Flush all tables and close and open log files
joseph@ubuntu:~$ mysqladmin -u joseph -p refresh
Show a list of active threads(clients).
joseph@ubuntu:~$ 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
joseph@ubuntu:~$ mysqladmin --verbose -u joseph -p password
Enter password:
New password:
Confirm new password:
Kill server thread(client)
First find the process id
or pid
joseph@ubuntu:~$ 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
joseph@ubuntu:~$ mysqladmin --verbose -u joseph -p kill 5
Reload grant privileges tables
joseph@ubuntu:~$ mysqladmin --verbose -u joseph -p flush-privileges
Flush log files
joseph@ubuntu:~$ mysqladmin --verbose -u joseph -p flush-logs
Flush all tables
joseph@ubuntu:~$ mysqladmin --verbose -u joseph -p flush-tables
Enter password:
notice, no more open tables after flushing the table cache
joseph@ubuntu:~$ 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
joseph@ubuntu:~$ mysqladmin --verbose -u joseph -p flush-threads