mysqladmin 工具的使用格式:
mysqladmin [option] command [command option] command
[root@localhost mysqladmin]# mysqladmin -uroot -p -i 5 -c 3 status
Enter password:
Uptime: 4700 Threads: 1 Questions: 855 Slow queries: 0 Opens: 129 Flush tables: 2 Open tables: 19 Queries per second avg: 0.181
Uptime: 4702 Threads: 1 Questions: 855 Slow queries: 0 Opens: 129 Flush tables: 2 Open tables: 19 Queries per second avg: 0.181
Uptime: 4704 Threads: 1 Questions: 855 Slow queries: 0 Opens: 129 Flush tables: 2 Open tables: 19 Queries per second avg: 0.181
[root@localhost mysqladmin]# mysqladmin -uroot -p status
Enter password:
Uptime: 4788 Threads: 1 Questions: 856 Slow queries: 0 Opens: 129 Flush tables: 2 Open tables: 19 Queries per second avg: 0.178
mysqladmin -u root -p原密码 password ‘newpassword’
[root@localhost mysqladmin]# mysqladmin -u root -predhat password 'newpassword'
mysqladmin -uroot -p ping
[root@localhost mysqladmin]# mysqladmin -uroot -p ping
Enter password:
mysqld is alive
mysqladmin -uroot -p version
[root@localhost mysqladmin]# mysqladmin -uroot -p version
Enter password:
mysqladmin Ver 9.0 Distrib 5.5.35-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Server version 5.5.35-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 1 hour 24 min 34 sec
Threads: 1 Questions: 868 Slow queries: 0 Opens: 130 Flush tables: 2 Open tables: 20 Queries per second avg: 0.171
mysqladmin -uroot -p extended-status
[root@localhost mysqladmin]# mysqladmin -uroot -p extended-status
Enter password:
+------------------------------------------+-------------+
| Variable_name | Value |
+------------------------------------------+-------------+
| Aborted_clients | 0 |
| Aborted_connects | 5 |
| Aria_pagecache_reads | 48 |
| Uptime_since_flush_status | 5098 |
+------------------------------------------+-------------+
mysqladmin -uroot -p variables
[root@localhost mysqladmin]# mysqladmin -uroot -p variables
mysqladmin -uroot -p processlist
mysqladmin -uroot -p-i 1 processlist //每秒刷新一次
[root@localhost mysqladmin]# mysqladmin -uroot -p processlist
Enter password:
+----+------+-----------+----+---------+------+-------+------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----+------+-----------+----+---------+------+-------+------------------+----------+
| 24 | root | localhost | | Query | 0 | | show processlist | 0.000 |
+----+------+-----------+----+---------+------+-------+------------------+----------+
mysqladmin -uroot -p create daba-test
[root@localhost mysqladmin]# mysqladmin -uroot -p create daba-test
mysqlshow -uroot -p
[root@localhost mysqladmin]# mysqlshow -uroot -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| information_schema |
| daba-test |
| mysql |
| new_db |
| test |
+--------------------+
mysqlshow -uroot -p daba-test
[root@localhost mysqladmin]# mysqlshow -uroot -p daba-test
Enter password:
Database: daba-test
+--------+
| Tables |
+--------+
+--------+
mysqlshow -uroot -p daba-test -v
[root@localhost mysqladmin]# mysqlshow -uroot -p daba-test -v
Enter password:
Database: daba-test
+--------+----------+
| Tables | Columns |
+--------+----------+
+--------+----------+
mysqlshow -uroot -p daba-test -v -v
[root@localhost mysqladmin]# mysqlshow -uroot -p daba-test -v -v
Enter password:
Database: daba-test
+--------+----------+------------+
| Tables | Columns | Total Rows |
+--------+----------+------------+
+--------+----------+------------+
mysqladmin -uroot -p drop daba-test
[root@localhost mysqladmin]# mysqladmin -uroot -p drop daba-test
Enter password:
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
mysqladmin -uroot -p reload
[root@localhost mysqladmin]# mysqladmin -uroot -p reload
mysqladmin -uroot -p refresh
[root@localhost mysqladmin]# mysqladmin -uroot -p refresh
mysqladmin -uroot -p shutdown
[root@localhost mysqladmin]# mysqladmin -uroot -p shutdown
[root@localhost ~]# mysqladmin -u root -ptmppassword flush-hosts
[root@localhost ~]# mysqladmin -u root -ptmppassword flush-logs
[root@localhost ~]# mysqladmin -u root -ptmppassword flush-privileges
[root@localhost ~]# mysqladmin -u root -ptmppassword flush-status
[root@localhost ~]# mysqladmin -u root -ptmppassword flush-tables
[root@localhost ~]# mysqladmin -u root -ptmppassword flush-threads
[root@localhost ~]# mysqladmin -uroot -p processlist
[root@localhost ~]# mysqladmin -uroot -p kill idnum
[root@localhost ~]# mysqladmin -u root -p stop-slave
[root@localhost ~]# mysqladmin -u root -p start-slave
[root@localhost ~]# mysqladmin -u root -p process status version