MYSQL命令行工具

1)mysqladmin

作用一:关闭数据库

[mysql@SR3 ~]$ mysqladmin -h10.86.87.155  -uroot -p shutdown
Enter password:

作用二:修改密码

[mysql@SR3 ~]$ mysqladmin -u root password 'infohow'

作用三:验证mysql是否可用及版本号

[mysql@SR3 ~]$ mysqladmin -h10.86.87.155  -uroot -p  ping
Enter password:
mysqld is alive

[mysql@SR3 ~]$ mysqladmin -h10.86.87.155  -uroot -p  version
Enter password:
mysqladmin  Ver 8.42 Distrib 5.5.16, for Linux on x86_64
Copyright (c) 2000, 2011, 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.5.16-log
Protocol version        10
Connection              10.86.87.155 via TCP/IP
TCP port                3306
Uptime:                 5 min 3 sec

Threads: 1  Questions: 2  Slow queries: 0  Opens: 33  Flush tables: 1  Open tables: 26  Queries per second avg: 0.006

 

 

2)mysqlcheck

验证clas数据库下面的表是否可用:

mysqlcheck执行表维护操作

 

[mysql@SR3 ~]$ mysqlcheck -h10.86.87.155  -uroot -p clas
Enter password:
clas.TEST_ISAM                                     OK
clas.TEST_InnoDB                                   OK
clas.t                                             OK
[mysql@SR3 ~]$

 

3)数据库备份命令

 

mysqldump数据库备份

mysqlhotcopy数据库备份

mysqlimport导入数据文件

 

这几个命令工具我们将在后边的备份恢复中详细讲解。

 

4)mysqlshow

mysqlshow显示信息数据库和表的相关信息

 

[mysql@SR3 ~]$ mysqlshow  -h10.86.87.155 -uroot -p clas
Enter password:
Database: clas
+-------------+
|   Tables    |
+-------------+
| TEST_ISAM   |
| TEST_InnoDB |
| t           |
+-------------+
[mysql@SR3 ~]$

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值