1、查看mysql server是否启动
[root@rh64 ~]# mysqladmin -u root -p ping
Enter password:
mysqld is alive
2、查看mysql server版本
[root@rh64 ~]# mysqladmin -u root -p version
Enter password:
mysqladmin Ver 8.42 Distrib 5.6.25-73.1, for Linux on x86_64
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Server version 5.6.25-73.1-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 1 min 33 sec
Threads: 1 Questions: 10 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.107
3、查看mysql server状态
[root@rh64 ~]# mysqladmin -u root -p status
Enter password:
Uptime: 156 Threads: 1 Questions: 13 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.083
4、查看mysql server扩展信息
[root@rh64 ~]# mysqladmin -u root -p extended-status
Enter password:
+-----------------------------------------------+-------------+
| Variable_name | Value |
+-----------------------------------------------+-------------+
| Aborted_clients | 0 |
| Aborted_connects | 1 |
| Binlog_snapshot_file | |
| Binlog_snapshot_position | 0 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Binlog_stmt_cache_disk_use | 0 |
| Binlog_stmt_cache_use | 0 |
......
5、查看mysql server变量信息
[root@rh64 ~]# mysqladmin -u root -p variables
1
2
3
4
5
6
|
------------------------------------------------------+ | auto_increment_increment | 1 | auto_increment_offset | 1 |
| autocommit | ON | | automatic_sp_privileges | ON | | avoid_temporal_upgrade | OFF |
6、查看mysql server进程
[root@rh64 ~]# mysqladmin -u root -p processlist
Enter password:
+----+------+-----------+----+---------+------+-------+------------------+-----------+---------------+
| Id | User | Host | db | Command | Time | State | Info | Rows_sent | Rows_examined |
+----+------+-----------+----+---------+------+-------+------------------+-----------+---------------+
| 13 | root | localhost | | Query | 0 | init | show processlist | 0 | 0 |
+----+------+-----------+----+---------+------+-------+------------------+-----------+---------------+
7、通过mysqladmin创建数据库
[root@rh64 ~]# mysqladmin -u root -p create testdb;
Enter password:
删除数据库:
[root@rh64 ~]# mysqladmin -u root -p drop testdb;
Enter password:
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 'testdb' database [y/N] y
Database "testdb" dropped
8、mysql server重新载入权限列表
[root@rh64 ~]# mysqladmin -u root -p reload
Enter password:
[root@rh64 ~]# mysqladmin -u root -p refresh
Enter password:
[root@rh64 ~]# mysqladmin -u root -p flush-hosts
Enter password:
[root@rh64 ~]# mysqladmin -u root -p flush-logs
Enter password:
[root@rh64 ~]# mysqladmin -u root -p flush-privileges
Enter password:
[root@rh64 ~]# mysqladmin -u root -p flush-status
Enter password:
[root@rh64 ~]# mysqladmin -u root -p flush-tables
Enter password:
[root@rh64 ~]# mysqladmin -u root -p flush-threads
Enter password:
9、通过mysqladmin关库
[root@rh64 ~]# mysqladmin -u root -p shutdown
Enter password: