博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL Study之--mysqladmin工具应用
阅读量:5930 次
发布时间:2019-06-19

本文共 3333 字,大约阅读时间需要 11 分钟。

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: 

本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1722830,如需转载请自行联系原作者
你可能感兴趣的文章
item style edit in sharepoint 2013
查看>>
开启Sharepoint 2013站点邮箱
查看>>
自动化运维工具Puppet在实际工作中的注意事项
查看>>
linux下控制帐户过期的多种方法
查看>>
实现Action逻辑
查看>>
学习像树一样活着!
查看>>
中国软件开发工程师之痛
查看>>
话里话外:企业吉祥高歌唱未来需“三宝”
查看>>
理解BPDU Guard的意义(BPDU Guard在全局配置与接口配置上的区别)
查看>>
互联网教育, 免费 !没有未来!!
查看>>
Hyper-V 2016 系列教程18 Windows 上的 Hyper-V 和 Windows Server 上的 Hyper-V 之间的差异
查看>>
How To Setup MongoDB 4.0 Replica Set
查看>>
有关软件测试的五大谣言
查看>>
SQL Server 2017 AlwaysOn AG 自动初始化(十)
查看>>
少说话多写代码之Python学习007——字符串的方法01
查看>>
linux系统安全基础汇总
查看>>
Python辅助安全测试常用代码示例
查看>>
6425C-Lab8 使用组策略管理安全性(2)
查看>>
Hadoop HDFS Java API
查看>>
在Linux系统中安装LAMP出现的错误总结
查看>>