MySQL Command工具

MySQL Command工具

mysqlcheck维护工具

用法
Usage: mysqlcheck [OPTIONS] database [tables]
OR     mysqlcheck [OPTIONS] --databases DB1 [DB2 DB3...]
OR     mysqlcheck [OPTIONS] --all-databases

option常用选项:
-c,--check 检查表;默认选项
-r,--repair 修复表
-a,--analyze 分析表;
-o,--optimize 优化表;
检查world库下的 city表
[root@server ~]# mysqlcheck -uroot -p -c world city
Enter password: 
world.city                                         OK

修复world库下的 city表 表存储引擎为Innodb不支持repair.
[root@server ~]# mysqlcheck -uroot -p -r world city
Enter password: 
world.city
note     : The storage engine for the table doesn't support repair

修复单个数据库
[root@server ~]# mysqlcheck -uroot -p -r --database world
Warning: Using unique option prefix database instead of databases is deprecated and will be removed in a future release. Please use the full name instead.
Enter password: 
world.city
note     : The storage engine for the table doesn't support repair
world.country
note     : The storage engine for the table doesn't support repair
world.countrylanguage
note     : The storage engine for the table doesn't support repair

修复所有数据库
[root@server ~]# mysqlcheck -uroot -p -r -A 
Enter password: 
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
student.class
note     : The storage engine for the table doesn't support repair
student.student
note     : The storage engine for the table doesn't support repair
student.test
note     : The storage engine for the table doesn't support repair
student.test1                                      OK
world.city
note     : The storage engine for the table doesn't support repair
world.country
note     : The storage engine for the table doesn't support repair
world.countrylanguage
note     : The storage engine for the table doesn't support repair

mysqldump数据导出工具

用法
Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
option:
-u,--user=name;
-p, --password[=name]	
-h, --host=name		指定主机名或IP
-P, --port=#,      指定端口

[root@server ~]# mysqldump -uroot -p  world > world.txt
Enter password: 

mysqlimport数据导入工具

Usage:
mysqlimport [OPTIONS] database textfile...
发布了65 篇原创文章 · 获赞 48 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/DoloresOOO/article/details/98081071