MYSQL命令行工具

来源:互联网 发布:ecshop3.6php版本 编辑:程序博客网 时间:2024/05/07 20:09

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 ~]$

 

 

 

 

 

 

 

原创粉丝点击