twn39 / code

:memo: 代码笔记,通过 issue 的方式记录日常遇到的问题和学习笔记
13 stars 1 forks source link

MySQL Utilities #105

Open twn39 opened 8 years ago

twn39 commented 8 years ago

MySQL Utilities 工具

twn39 commented 8 years ago

拷贝数据库

如果需要对真实数据进行测试,可以拷贝一个副本

mysqldbcopy --source=root:pass@localhost:3310 --destination=root:pass@localhost util_test:util_test_copy

手册:http://dev.mysql.com/doc/mysql-utilities/1.6/en/mysqldbcopy.html

twn39 commented 8 years ago

磁盘使用量

mysqldiskusage --server=root@localhost

显示如下:

WARNING: Using a password on the command line interface can be insecure.
# Source on localhost: ... connected.
# Database totals:
+---------------------+-------------+
| db_name             |      total  |
+---------------------+-------------+
| mosign_copy         | 127,591     |
| mysql               | 14,217,055  |
| performance_schema  | 818,071     |
| sys                 | 500,802     |
+---------------------+-------------+

Total database disk usage = 15,663,519 bytes or 14.94 MB

#...done.
twn39 commented 8 years ago

检查重复的索引

mysqlindexcheck --server=root@localhost employees

手册:http://dev.mysql.com/doc/mysql-utilities/1.6/en/mysqlindexcheck.html