新学到的mysql命令(updating)

part1 mysqlshow

mysqlshow
显示MySQL中数据库相关信息

补充说明
mysqlshow命令 用于显示mysql服务器中数据库、表和列表信息。

语法
mysqlshow(选项)(参数)
选项

-h:MySQL服务器的ip地址或主机名;
-u:连接MySQL服务器的用户名;
-p:连接MySQL服务器的密码;
--count:显示每个数据表中数据的行数;
-k:显示数据表的索引;
-t:显示数据表的类型;
-i:显示数据表的额外信息。

官网解释:https://dev.mysql.com/doc/refman/8.0/en/mysqlshow.html

root@li1548-187:/# mysqlshow -uroot -p123456 teddylt --count -t
mysqlshow: [Warning] Using a password on the command line interface can be insecure.
Database: teddylt
+-----------------------------+------------+----------+------------+
| Tables | table_type | Columns | Total Rows |
+-----------------------------+------------+----------+------------+
| wp_actionscheduler_actions | BASE TABLE | 13 | 1508 |
| wp_actionscheduler_claims | BASE TABLE | 2 | 0 |
| wp_actionscheduler_groups | BASE TABLE | 2 | 2 |
| wp_actionscheduler_logs | BASE TABLE | 5 | 4518 |
| wp_aioseo_notifications | BASE TABLE | 17 | 4 |
| wp_aioseo_posts | BASE TABLE | 54 | 710 |
| wp_aiowps_events | BASE TABLE | 10 | 730 |
| wp_aiowps_failed_logins | BASE TABLE | 5 | 5000 |
| wp_aiowps_global_meta | BASE TABLE | 12 | 0 |
| wp_aiowps_login_activity | BASE TABLE | 8 | 369 |
| wp_aiowps_login_lockdown | BASE TABLE | 8 | 201 |
| wp_aiowps_permanent_block | BASE TABLE | 6 | 0 |
| wp_commentmeta | BASE TABLE | 4 | 0 |
| wp_comments | BASE TABLE | 15 | 10 |
| wp_gwolle_gb_entries | BASE TABLE | 17 | 0 |
| wp_gwolle_gb_log | BASE TABLE | 5 | 0 |
| wp_history | BASE TABLE | 8 | 46 |
| wp_history_admin | BASE TABLE | 4 | 1 |
| wp_links | BASE TABLE | 13 | 0 |
| wp_options | BASE TABLE | 4 | 434 |
| wp_postmeta | BASE TABLE | 4 | 4743 |
| wp_posts | BASE TABLE | 23 | 3634 |
| wp_ppress_forms | BASE TABLE | 6 | 7 |
| wp_ppress_formsmeta | BASE TABLE | 5 | 219 |
| wp_ppress_meta_data | BASE TABLE | 4 | 0 |
| wp_social_polling | BASE TABLE | 6 | 0 |
| wp_social_polling_comments | BASE TABLE | 6 | 0 |
| wp_term_relationships | BASE TABLE | 3 | 930 |
| wp_term_taxonomy | BASE TABLE | 6 | 430 |
| wp_termmeta | BASE TABLE | 4 | 7 |
| wp_terms | BASE TABLE | 4 | 430 |
| wp_usermeta | BASE TABLE | 4 | 59 |
| wp_users | BASE TABLE | 10 | 1 |
| wp_wc_avatars_cache | BASE TABLE | 7 | 0 |
| wp_wc_comments_subscription | BASE TABLE | 9 | 0 |
| wp_wc_feedback_forms | BASE TABLE | 6 | 0 |
| wp_wc_follow_users | BASE TABLE | 12 | 0 |
| wp_wc_phrases | BASE TABLE | 3 | 0 |
| wp_wc_users_rated | BASE TABLE | 6 | 6 |
| wp_wc_users_voted | BASE TABLE | 7 | 0 |
| wp_wpgmza | BASE TABLE | 20 | 2 |
| wp_wpgmza_circles | BASE TABLE | 7 | 0 |
| wp_wpgmza_maps | BASE TABLE | 35 | 2 |
| wp_wpgmza_polygon | BASE TABLE | 15 | 0 |
| wp_wpgmza_polylines | BASE TABLE | 7 | 0 |
| wp_wpgmza_rectangles | BASE TABLE | 7 | 0 |
+-----------------------------+------------+----------+------------+
46 rows in set.

 

使用场景
1)用于MySQL从旧库到新库,检查数据库是否是一致的!!!

part2

在MySQL中如何给普通用户授予查看所有用户线程/连接的权限

默认情况下show processlist是可以查看当前用户的线程/连接的

如果不给拥有授予PROESS权限 ,show processlist命令只能看到当前用户的线程,而授予了PROCESS权限后,使用show  processlist就能看到所有用户的线程。官方文档的介绍如下:

SHOW PROCESSLIST shows you which threads are running. You can also get this information from the INFORMATION_SCHEMA PROCESSLIST table or the mysqladmin processlist command. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MySQL account that you are using). If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.

我们先创建下面账号test2,然后测试如下:

CREATE DATABASE dl_an_124_127_v10 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON dl_an_124_127_v10.* TO dl_an124game@'%' IDENTIFIED BY 'dl_an124game' WITH GRANT OPTION;
GRANT PROCESS ON *.* TO dl_an124game@'%' IDENTIFIED BY 'dl_an124game' WITH GRANT OPTION;
flush privileges;

如果给用户授予了PROCESS权限, 那么用户就拥有了使用SHOW ENGINES命令的权限,如下所示

mysql> select user();
+----------------+
| user()         |
+----------------+
| test@localhost |
+----------------+
1 row in set (0.00 sec)
 
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

 

PART3

关于mysqldump的2个参数的应用!!!

1)--skip-extended-insert

#Turn off extended-insert  #关闭扩展插入!!!

默认mysqldump会将多条插入语句导出成一条insert语句格式,如:

insert into t values(1),(2);

那有时我想生成多条insert语句,如:
insert into t values(1);
insert into t values(2);
这时,在mysqldump时加上参数--skip-extended-insert即可,这样使导出文件更小,并加速导入时的速度

2)--complete-insert

#用完整插入并且申明包括字段名
--complete-insert Use complete INSERT statements that include column names

 

part4

工作中常用的函数

1)count()函数

统计表中包含的记录行的总数和统计根据查询结果返回列中包含的数据行数

用法:

a)count(*),计算表中的总行数,无论是否有值或者是空值

b)count(字段名),计算指定列的总行数,将忽略空值的行

mysql> select * from person;
+----+-----------+-----+------------------+
| id | name      | age | info             |
+----+-----------+-----+------------------+
|  1 | teddy     |  33 | DevOps-Engineer  |
|  2 | juice     |  32 | educator         |
|  3 | laozhang  |  33 | Python-Developer |
|  4 | laowu     |  31 | banker           |
|  5 | honglaing |  33 | singer           |
|  6 | renzhong  |  18 | car-retailer     |
|  7 | laoliao   |  18 | security-staff   |
|  8 | laoyu     |  18 | C++ Developer    |
| 10 | liuqiang  |  35 | security         |
| 12 | npc       |  99 | NULL             |
+----+-----------+-----+------------------+
10 rows in set (0.00 sec)

mysql> select count(*) as person_total_rows from person;
+-------------------+
| person_total_rows |
+-------------------+
|                10 |
+-------------------+
1 row in set (0.00 sec)

mysql> select count(info) as person_total_rows_of_info from person;
+---------------------------+
| person_total_rows_of_info |
+---------------------------+
|                         9 |
+---------------------------+
1 row in set (0.00 sec)

 

2)sum()函数

mysql> select sum(age) as person_total_of_ages from person;
+----------------------+
| person_total_of_ages |
+----------------------+
|                  350 |
+----------------------+
1 row in set (0.00 sec)

3)avg()函数

mysql> select avg(age) as person_average_of_ages from person;
+------------------------+
| person_average_of_ages |
+------------------------+
|                35.0000 |
+------------------------+
1 row in set (0.00 sec)

 

4)max()函数

mysql> select max(age) as person_max_age from person;
+----------------+
| person_max_age |
+----------------+
|             99 |
+----------------+
1 row in set (0.00 sec)

 

4)min()函数

mysql> select min(age) as person_min_age from person;
+----------------+
| person_min_age |
+----------------+
|             18 |
+----------------+
1 row in set (0.00 sec)

 

Part5

查看MySQL数据库、表容量大小

1.查看所有数据库容量大小

mysql> select
    -> table_schema as 'db',
    -> sum(table_rows) as 'record',
    -> sum(truncate(data_length/1024/1024,2)) as "data capacity(MB)",
    -> sum(truncate(index_length/1024/1024,2)) as "index capacity(MB)"
    -> from information_schema.tables
    -> group by table_schema
    -> order by sum(data_length) desc,sum(index_length) desc;
+--------------------+----------+-------------------+--------------------+
| db                 | record   | data capacity(MB) | index capacity(MB) |
+--------------------+----------+-------------------+--------------------+
| dl_an5_6_50_v2     | 24508252 |           3912.77 |            1127.54 |
| mysql              |     3593 |              0.85 |               0.06 |
| test               |       30 |              0.08 |               0.01 |
| company            |        0 |              0.02 |               0.02 |
| teddylu            |        7 |              0.02 |               0.00 |
| information_schema |     NULL |              0.00 |               0.00 |
| performance_schema |    74026 |              0.00 |               0.00 |
+--------------------+----------+-------------------+--------------------+
7 rows in set (2.55 sec)


2.查看所有数据库各表容量大小

mysql> select table_schema as 'db', table_name as 'table_name', table_rows as 'record', truncate(data_length/1024/1024, 2) as 'data capacity(MB)', truncate(index_length/1024/1024, 2) as 'index capacity(MB)' from information_schema.tables ;
+--------------------+----------------------------------------------------+---------+-------------------+--------------------+
| db                 | table_name                                         | record  | data capacity(MB) | index capacity(MB) |
+--------------------+----------------------------------------------------+---------+-------------------+--------------------+
| information_schema | CHARACTER_SETS                                     |    NULL |              0.00 |               0.00 |
| information_schema | COLLATIONS                                         |    NULL |              0.00 |               0.00 |
| information_schema | COLLATION_CHARACTER_SET_APPLICABILITY              |    NULL |              0.00 |               0.00 |
| information_schema | COLUMNS                                            |    NULL |              0.00 |               0.00 |
| information_schema | COLUMN_PRIVILEGES                                  |    NULL |              0.00 |               0.00 |
| information_schema | ENGINES                                            |    NULL |              0.00 |               0.00 |
| information_schema | EVENTS                                             |    NULL |              0.00 |               0.00 |
| information_schema | FILES                                              |    NULL |              0.00 |               0.00 |
| information_schema | GLOBAL_STATUS                                      |    NULL |              0.00 |               0.00 |
| information_schema | GLOBAL_VARIABLES                                   |    NULL |              0.00 |               0.00 |
| information_schema | KEY_COLUMN_USAGE                                   |    NULL |              0.00 |               0.00 |
| information_schema | OPTIMIZER_TRACE                                    |    NULL |              0.00 |               0.00 |
| information_schema | PARAMETERS                                         |    NULL |              0.00 |               0.00 |
| information_schema | PARTITIONS                                         |    NULL |              0.00 |               0.00 |
| information_schema | PLUGINS                                            |    NULL |              0.00 |               0.00 |
| information_schema | PROCESSLIST                                        |    NULL |              0.00 |               0.00 |
| information_schema | PROFILING                                          |    NULL |              0.00 |               0.00 |
| information_schema | REFERENTIAL_CONSTRAINTS                            |    NULL |              0.00 |               0.00 |
| information_schema | ROUTINES                                           |    NULL |              0.00 |               0.00 |
| information_schema | SCHEMATA                                           |    NULL |              0.00 |               0.00 |
| information_schema | SCHEMA_PRIVILEGES                                  |    NULL |              0.00 |               0.00 |
| information_schema | SESSION_STATUS                                     |    NULL |              0.00 |               0.00 |
| information_schema | SESSION_VARIABLES                                  |    NULL |              0.00 |               0.00 |
| information_schema | STATISTICS                                         |    NULL |              0.00 |               0.00 |
| information_schema | TABLES                                             |    NULL |              0.00 |               0.00 |
| information_schema | TABLESPACES                                        |    NULL |              0.00 |               0.00 |
| information_schema | TABLE_CONSTRAINTS                                  |    NULL |              0.00 |               0.00 |
| information_schema | TABLE_PRIVILEGES                                   |    NULL |              0.00 |               0.00 |
| information_schema | TRIGGERS                                           |    NULL |              0.00 |               0.00 |
| information_schema | USER_PRIVILEGES                                    |    NULL |              0.00 |               0.00 |
| information_schema | VIEWS                                              |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_LOCKS                                       |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_TRX                                         |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_DATAFILES                               |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_LOCK_WAITS                                  |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_TABLESTATS                              |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_CMP                                         |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_METRICS                                     |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_CMP_RESET                                   |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_CMP_PER_INDEX                               |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_CMPMEM_RESET                                |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_FT_DELETED                                  |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_BUFFER_PAGE_LRU                             |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_FOREIGN                                 |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_COLUMNS                                 |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_INDEXES                                 |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_FT_DEFAULT_STOPWORD                         |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_FIELDS                                  |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_CMP_PER_INDEX_RESET                         |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_BUFFER_PAGE                                 |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_CMPMEM                                      |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_FT_INDEX_TABLE                              |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_FT_BEING_DELETED                            |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_TABLESPACES                             |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_FT_INDEX_CACHE                              |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_FOREIGN_COLS                            |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_SYS_TABLES                                  |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_BUFFER_POOL_STATS                           |    NULL |              0.00 |               0.00 |
| information_schema | INNODB_FT_CONFIG                                   |    NULL |              0.00 |               0.00 |
| company            | employees                                          |       0 |              0.01 |               0.01 |
| company            | offices                                            |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | activitylist_global                                |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | arena_rank_10v10                                   |     200 |              0.06 |               0.00 |
| dl_an5_6_50_v2     | arena_rank_3v3                                     |     200 |              0.06 |               0.00 |
| dl_an5_6_50_v2     | arena_rank_5v5                                     |     200 |              0.06 |               0.00 |
| dl_an5_6_50_v2     | cemetery_rank                                      |      21 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | core_id_allot                                      |       0 |              0.01 |               0.03 |
| dl_an5_6_50_v2     | demo_achieve                                       |  555633 |             71.60 |              22.56 |
| dl_an5_6_50_v2     | demo_achieve_7_day                                 | 4470262 |            510.00 |             210.95 |
| dl_an5_6_50_v2     | demo_achieve_rank                                  |     300 |              0.09 |               0.00 |
| dl_an5_6_50_v2     | demo_activatekey                                   |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_active_soul_ring                              |  184926 |             12.51 |               7.51 |
| dl_an5_6_50_v2     | demo_activity                                      |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_activity_custom                               |    9002 |              1.51 |               0.00 |
| dl_an5_6_50_v2     | demo_activitycontrol                               |   58710 |             25.56 |               0.00 |
| dl_an5_6_50_v2     | demo_activitylist                                  | 1124768 |            200.75 |              51.64 |
| dl_an5_6_50_v2     | demo_answer_rank                                   |      43 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_artifact                                      |   56034 |              4.51 |               0.00 |
| dl_an5_6_50_v2     | demo_artifact_uniqueskill                          |   58745 |             10.51 |               0.00 |
| dl_an5_6_50_v2     | demo_attend_log                                    |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_attend_rep_log                                |  314371 |             39.57 |              13.54 |
| dl_an5_6_50_v2     | demo_auction                                       |   18208 |              2.51 |               1.51 |
| dl_an5_6_50_v2     | demo_auction_item                                  |     212 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_auction_log                                   |    3261 |              0.42 |               0.00 |
| dl_an5_6_50_v2     | demo_banned                                        |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_buff                                          |    5337 |              1.51 |               0.37 |
| dl_an5_6_50_v2     | demo_camp                                          |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_camp_rank                                     |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_combat_rank                                   |     200 |              0.07 |               0.00 |
| dl_an5_6_50_v2     | demo_competition_human                             |   15303 |              7.51 |               0.78 |
| dl_an5_6_50_v2     | demo_competition_log                               |    3495 |              0.48 |               0.68 |
| dl_an5_6_50_v2     | demo_competition_mirror                            |   13936 |             13.51 |               2.12 |
| dl_an5_6_50_v2     | demo_cost_log                                      | 4483748 |            514.00 |             165.84 |
| dl_an5_6_50_v2     | demo_delegate                                      |   55650 |             18.54 |               1.51 |
| dl_an5_6_50_v2     | demo_even_charge                                   |     267 |              0.06 |               0.00 |
| dl_an5_6_50_v2     | demo_faction                                       |      40 |              0.12 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_activity                              |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_building                              |     280 |              0.04 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_deity_beast                           |     481 |              0.06 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_donate_records                        |  289695 |             19.54 |               6.51 |
| dl_an5_6_50_v2     | demo_faction_fund_log                              |  309063 |             34.56 |               8.51 |
| dl_an5_6_50_v2     | demo_faction_machine                               |     280 |              0.04 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_member                                |    2835 |              1.51 |               0.10 |
| dl_an5_6_50_v2     | demo_faction_merge_record                          |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_moving                                |   22968 |              3.51 |               3.03 |
| dl_an5_6_50_v2     | demo_faction_notice                                |    1171 |              0.18 |               0.06 |
| dl_an5_6_50_v2     | demo_faction_qualify_record                        |       8 |              0.01 |               0.04 |
| dl_an5_6_50_v2     | demo_faction_record                                |       2 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_redgift                               |     890 |              1.51 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_repo_item                             |     237 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_repo_log                              |    2585 |              0.26 |               0.14 |
| dl_an5_6_50_v2     | demo_faction_spread                                |     481 |              0.06 |               0.01 |
| dl_an5_6_50_v2     | demo_faction_trade                                 |   13706 |              1.51 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_trade_help                            |      15 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_trade_order                           |   27529 |              3.51 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_trade_order_goods                     |   96316 |              6.51 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_war                                   |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_faction_war_final_rank                        |       8 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_fallen_soul_npc_record                        |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_fashion                                       |   56128 |             16.54 |               1.51 |
| dl_an5_6_50_v2     | demo_fill_mail                                     |       5 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_flyback_info                                  |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_friend                                        |   50425 |             10.51 |               1.51 |
| dl_an5_6_50_v2     | demo_friend_group_info                             |      10 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_general                                       |  256448 |            125.67 |              24.54 |
| dl_an5_6_50_v2     | demo_general_rank                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_giftactivate                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_human                                         |   52307 |             82.62 |              16.60 |
| dl_an5_6_50_v2     | demo_human_daily_reset_time                        |   26740 |              2.51 |               1.51 |
| dl_an5_6_50_v2     | demo_human_info                                    |   50438 |            109.64 |               0.00 |
| dl_an5_6_50_v2     | demo_human_subjoin_info                            |   54008 |             78.60 |               0.00 |
| dl_an5_6_50_v2     | demo_human_world_boss                              |      26 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_instance                                      |  645154 |             31.56 |              26.59 |
| dl_an5_6_50_v2     | demo_instance_rank                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_item                                          | 2799468 |            340.89 |             190.42 |
| dl_an5_6_50_v2     | demo_killer_log                                    |   39861 |              3.51 |               5.03 |
| dl_an5_6_50_v2     | demo_level_rank                                    |     200 |              0.07 |               0.00 |
| dl_an5_6_50_v2     | demo_mail                                          |   35313 |              9.51 |               3.03 |
| dl_an5_6_50_v2     | demo_medal_task                                    |  210672 |            315.87 |               0.00 |
| dl_an5_6_50_v2     | demo_monster                                       |       0 |              0.01 |               0.03 |
| dl_an5_6_50_v2     | demo_month_card                                    |    2378 |              0.20 |               0.00 |
| dl_an5_6_50_v2     | demo_operate_activity                              |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_output_filter                                 |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_part                                          |  561064 |             51.59 |              12.54 |
| dl_an5_6_50_v2     | demo_part_mirror                                   |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_pay_drop_num                                  |      96 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_pay_log                                       |   40900 |              6.51 |               5.03 |
| dl_an5_6_50_v2     | demo_pet                                           |   64182 |             55.59 |               6.54 |
| dl_an5_6_50_v2     | demo_pet_info                                      |   56641 |              5.51 |               0.00 |
| dl_an5_6_50_v2     | demo_pet_rank                                      |     300 |              0.18 |               0.00 |
| dl_an5_6_50_v2     | demo_pocket_line                                   |  188385 |             19.54 |               7.51 |
| dl_an5_6_50_v2     | demo_quest                                         |   55989 |             38.57 |               1.51 |
| dl_an5_6_50_v2     | demo_quest_item                                    |  311018 |             25.56 |              11.54 |
| dl_an5_6_50_v2     | demo_question_complaint                            |       0 |              0.01 |               0.03 |
| dl_an5_6_50_v2     | demo_rank_charge_gold                              |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_rank_rose                                     |      17 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_rare_item_log                                 | 4917853 |            462.00 |             283.57 |
| dl_an5_6_50_v2     | demo_red_bag                                       |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_red_bag_record                                |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_ringslots                                     |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_setting                                       |   57596 |              4.51 |               1.51 |
| dl_an5_6_50_v2     | demo_shop                                          |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_soul                                          |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_soul_bone                                     |   57476 |              3.51 |               1.51 |
| dl_an5_6_50_v2     | demo_soul_bone_equip                               |    5962 |              0.35 |               0.20 |
| dl_an5_6_50_v2     | demo_soul_bone_reward                              |   43690 |             20.54 |               0.00 |
| dl_an5_6_50_v2     | demo_soul_ring                                     |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_soul_title                                    |  255807 |             22.56 |               0.00 |
| dl_an5_6_50_v2     | demo_soul_tower                                    |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_talent                                        |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_team                                          |    1559 |              0.23 |               0.06 |
| dl_an5_6_50_v2     | demo_team_member                                   |     662 |              0.14 |               0.03 |
| dl_an5_6_50_v2     | demo_time_record                                   |       9 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | demo_to_view                                       |    9571 |             33.56 |               0.35 |
| dl_an5_6_50_v2     | demo_tower                                         |  254390 |             15.54 |               0.00 |
| dl_an5_6_50_v2     | demo_tower2_rank                                   |     236 |              0.07 |               0.00 |
| dl_an5_6_50_v2     | demo_tower_mirror                                  |       0 |              0.01 |               0.06 |
| dl_an5_6_50_v2     | demo_tower_rank                                    |     259 |              0.07 |               0.00 |
| dl_an5_6_50_v2     | demo_turntable                                     |     292 |              0.06 |               0.01 |
| dl_an5_6_50_v2     | demo_turntablehistory                              |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_unit_propplus                                 |  485668 |            217.76 |               0.00 |
| dl_an5_6_50_v2     | demo_war_final                                     |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | demo_wine                                          |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | entrust_quest                                      |  183416 |             13.51 |               8.51 |
| dl_an5_6_50_v2     | faction_combat_rank                                |     382 |              0.06 |               0.00 |
| dl_an5_6_50_v2     | faction_explore_rank                               |       6 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | faction_qualify_rank                               |      41 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | game_session                                       |       3 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | global_data                                        |       0 |              0.01 |               0.01 |
| dl_an5_6_50_v2     | humanmirror                                        |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | humanqunying                                       |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | hunting_rank                                       |      65 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeanswer                                   |      22 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleebomb                                     |      16 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding                                   |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding10                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding11                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding12                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding13                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding14                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding15                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding16                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding17                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding18                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding19                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding2                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding20                                 |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding3                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding4                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding5                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding6                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding7                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding8                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | rank_meleeriding9                                  |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | seagod_rank                                        |     154 |              0.09 |               0.00 |
| dl_an5_6_50_v2     | server_global                                      |       0 |              0.01 |               0.00 |
| dl_an5_6_50_v2     | shopping_mall                                      |  418165 |            238.78 |              18.56 |
| dl_an5_6_50_v2     | threetothree                                       |   55153 |             39.57 |               0.00 |
| dl_an5_6_50_v2     | word_boss                                          |       4 |              0.01 |               0.00 |
| mysql              | columns_priv                                       |       0 |              0.00 |               0.00 |
| mysql              | db                                                 |       2 |              0.00 |               0.00 |
| mysql              | event                                              |       0 |              0.00 |               0.00 |
| mysql              | func                                               |       0 |              0.00 |               0.00 |
| mysql              | general_log                                        |       2 |              0.00 |               0.00 |
| mysql              | help_category                                      |      40 |              0.00 |               0.00 |
| mysql              | help_keyword                                       |     619 |              0.11 |               0.02 |
| mysql              | help_relation                                      |    1273 |              0.01 |               0.02 |
| mysql              | help_topic                                         |     585 |              0.55 |               0.02 |
| mysql              | innodb_index_stats                                 |     955 |              0.14 |               0.00 |
| mysql              | innodb_table_stats                                 |     170 |              0.01 |               0.00 |
| mysql              | ndb_binlog_index                                   |       0 |              0.00 |               0.00 |
| mysql              | plugin                                             |       0 |              0.00 |               0.00 |
| mysql              | proc                                               |       0 |              0.00 |               0.00 |
| mysql              | procs_priv                                         |       0 |              0.00 |               0.00 |
| mysql              | proxies_priv                                       |       2 |              0.00 |               0.00 |
| mysql              | servers                                            |       0 |              0.00 |               0.00 |
| mysql              | slave_master_info                                  |       0 |              0.01 |               0.00 |
| mysql              | slave_relay_log_info                               |       0 |              0.01 |               0.00 |
| mysql              | slave_worker_info                                  |       0 |              0.01 |               0.00 |
| mysql              | slow_log                                           |       2 |              0.00 |               0.00 |
| mysql              | tables_priv                                        |       0 |              0.00 |               0.00 |
| mysql              | time_zone                                          |       0 |              0.00 |               0.00 |
| mysql              | time_zone_leap_second                              |       0 |              0.00 |               0.00 |
| mysql              | time_zone_name                                     |       0 |              0.00 |               0.00 |
| mysql              | time_zone_transition                               |       0 |              0.00 |               0.00 |
| mysql              | time_zone_transition_type                          |       0 |              0.00 |               0.00 |
| mysql              | user                                               |       7 |              0.00 |               0.00 |
| performance_schema | accounts                                           |    1000 |              0.00 |               0.00 |
| performance_schema | cond_instances                                     |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_current                              |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_history                              |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_history_long                         |   10000 |              0.00 |               0.00 |
| performance_schema | events_stages_summary_by_account_by_event_name     |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_summary_by_host_by_event_name        |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_summary_by_thread_by_event_name      |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_summary_by_user_by_event_name        |    1000 |              0.00 |               0.00 |
| performance_schema | events_stages_summary_global_by_event_name         |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_current                          |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_history                          |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_history_long                     |   10000 |              0.00 |               0.00 |
| performance_schema | events_statements_summary_by_account_by_event_name |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_summary_by_digest                |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_summary_by_host_by_event_name    |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_summary_by_thread_by_event_name  |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_summary_by_user_by_event_name    |    1000 |              0.00 |               0.00 |
| performance_schema | events_statements_summary_global_by_event_name     |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_current                               |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_history                               |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_history_long                          |   10000 |              0.00 |               0.00 |
| performance_schema | events_waits_summary_by_account_by_event_name      |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_summary_by_host_by_event_name         |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_summary_by_instance                   |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_summary_by_thread_by_event_name       |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_summary_by_user_by_event_name         |    1000 |              0.00 |               0.00 |
| performance_schema | events_waits_summary_global_by_event_name          |    1000 |              0.00 |               0.00 |
| performance_schema | file_instances                                     |    1000 |              0.00 |               0.00 |
| performance_schema | file_summary_by_event_name                         |    1000 |              0.00 |               0.00 |
| performance_schema | file_summary_by_instance                           |    1000 |              0.00 |               0.00 |
| performance_schema | host_cache                                         |    1000 |              0.00 |               0.00 |
| performance_schema | hosts                                              |    1000 |              0.00 |               0.00 |
| performance_schema | mutex_instances                                    |    1000 |              0.00 |               0.00 |
| performance_schema | objects_summary_global_by_type                     |    1000 |              0.00 |               0.00 |
| performance_schema | performance_timers                                 |       5 |              0.00 |               0.00 |
| performance_schema | rwlock_instances                                   |    1000 |              0.00 |               0.00 |
| performance_schema | session_account_connect_attrs                      |    1000 |              0.00 |               0.00 |
| performance_schema | session_connect_attrs                              |    1000 |              0.00 |               0.00 |
| performance_schema | setup_actors                                       |       1 |              0.00 |               0.00 |
| performance_schema | setup_consumers                                    |      12 |              0.00 |               0.00 |
| performance_schema | setup_instruments                                  |    1000 |              0.00 |               0.00 |
| performance_schema | setup_objects                                      |       4 |              0.00 |               0.00 |
| performance_schema | setup_timers                                       |       4 |              0.00 |               0.00 |
| performance_schema | socket_instances                                   |    1000 |              0.00 |               0.00 |
| performance_schema | socket_summary_by_event_name                       |    1000 |              0.00 |               0.00 |
| performance_schema | socket_summary_by_instance                         |    1000 |              0.00 |               0.00 |
| performance_schema | table_io_waits_summary_by_index_usage              |    1000 |              0.00 |               0.00 |
| performance_schema | table_io_waits_summary_by_table                    |    1000 |              0.00 |               0.00 |
| performance_schema | table_lock_waits_summary_by_table                  |    1000 |              0.00 |               0.00 |
| performance_schema | threads                                            |    1000 |              0.00 |               0.00 |
| performance_schema | users                                              |    1000 |              0.00 |               0.00 |
| teddylu            | lishi                                              |       2 |              0.01 |               0.00 |
| teddylu            | test1                                              |       4 |              0.01 |               0.00 |
| test               | person                                             |       9 |              0.01 |               0.01 |
| test               | person_old                                         |       2 |              0.01 |               0.00 |
| test               | tmp3                                               |       2 |              0.01 |               0.00 |
| test               | tmp4                                               |       7 |              0.01 |               0.00 |
| test               | tmp5                                               |       3 |              0.01 |               0.00 |
| test               | tmp6                                               |       0 |              0.01 |               0.00 |
| test               | tmp7                                               |       0 |              0.01 |               0.00 |
| test               | tmp8                                               |       0 |              0.01 |               0.00 |
+--------------------+----------------------------------------------------+---------+-------------------+--------------------+
309 rows in set (0.01 sec)

3.查看指定数据库容量大小
mysql> select table_schema as 'db', sum(table_rows) as 'records', sum(truncate(data_length/1024/1024,2)) as 'data capacity(MB)', sum(truncate(index_length/1024/1024,2)) as 'index capacity(MB)' from information_schema.tables where table_schema='mysql';
+-------+---------+-------------------+--------------------+
| db    | records | data capacity(MB) | index capacity(MB) |
+-------+---------+-------------------+--------------------+
| mysql |    3657 |              0.85 |               0.06 |
+-------+---------+-------------------+--------------------+
1 row in set (0.00 sec)

4.查看指定数据库各表容量大小
mysql> select
    -> table_schema as '数据库',
    -> table_name as '表名',
    -> table_rows as '记录数',
    -> truncate(data_length/1024/1024, 2) as '数据容量(MB)',
    -> truncate(index_length/1024/1024, 2) as '索引容量(MB)'
    -> from information_schema.tables
    -> where table_schema='mysql'
    -> order by data_length desc, index_length desc;
+-----------+---------------------------+-----------+------------------+------------------+
| 数据库    | 表名                      | 记录数    | 数据容量(MB)     | 索引容量(MB)     |
+-----------+---------------------------+-----------+------------------+------------------+
| mysql     | help_topic                |       585 |             0.55 |             0.02 |
| mysql     | innodb_index_stats        |       955 |             0.14 |             0.00 |
| mysql     | help_keyword              |       619 |             0.11 |             0.02 |
| mysql     | slave_worker_info         |         0 |             0.01 |             0.00 |
| mysql     | slave_relay_log_info      |         0 |             0.01 |             0.00 |
| mysql     | slave_master_info         |         0 |             0.01 |             0.00 |
| mysql     | innodb_table_stats        |       170 |             0.01 |             0.00 |
| mysql     | help_relation             |      1273 |             0.01 |             0.02 |
| mysql     | proxies_priv              |         2 |             0.00 |             0.00 |
| mysql     | help_category             |        40 |             0.00 |             0.00 |
| mysql     | db                        |         2 |             0.00 |             0.00 |
| mysql     | user                      |         7 |             0.00 |             0.00 |
| mysql     | procs_priv                |         0 |             0.00 |             0.00 |
| mysql     | columns_priv              |         0 |             0.00 |             0.00 |
| mysql     | tables_priv               |         0 |             0.00 |             0.00 |
| mysql     | proc                      |         0 |             0.00 |             0.00 |
| mysql     | event                     |         0 |             0.00 |             0.00 |
| mysql     | func                      |         0 |             0.00 |             0.00 |
| mysql     | servers                   |         0 |             0.00 |             0.00 |
| mysql     | time_zone_transition_type |         0 |             0.00 |             0.00 |
| mysql     | plugin                    |         0 |             0.00 |             0.00 |
| mysql     | time_zone_transition      |         0 |             0.00 |             0.00 |
| mysql     | ndb_binlog_index          |         0 |             0.00 |             0.00 |
| mysql     | time_zone_name            |         0 |             0.00 |             0.00 |
| mysql     | time_zone_leap_second     |         0 |             0.00 |             0.00 |
| mysql     | time_zone                 |         0 |             0.00 |             0.00 |
| mysql     | general_log               |         2 |             0.00 |             0.00 |
| mysql     | slow_log                  |         2 |             0.00 |             0.00 |
+-----------+---------------------------+-----------+------------------+------------------+
28 rows in set (0.00 sec)

 

part6

show-variables-v5.6.39

Variable_name	Value
auto_increment_increment	1
auto_increment_offset	1
autocommit	ON
automatic_sp_privileges	ON
avoid_temporal_upgrade	OFF
back_log	80
basedir	/application/mysql-5.6.39/
big_tables	OFF
bind_address	*
binlog_cache_size	32768
binlog_checksum	CRC32
binlog_direct_non_transactional_updates	OFF
binlog_error_action	IGNORE_ERROR
binlog_format	STATEMENT
binlog_gtid_simple_recovery	OFF
binlog_max_flush_queue_time	0
binlog_order_commits	ON
binlog_row_image	FULL
binlog_rows_query_log_events	OFF
binlog_stmt_cache_size	32768
binlogging_impossible_mode	IGNORE_ERROR
block_encryption_mode	aes-128-ecb
bulk_insert_buffer_size	8388608
character_set_client	utf8
character_set_connection	utf8
character_set_database	utf8
character_set_filesystem	binary
character_set_results	utf8
character_set_server	utf8
character_set_system	utf8
character_sets_dir	/application/mysql-5.6.39/share/charsets/
collation_connection	utf8_general_ci
collation_database	utf8_general_ci
collation_server	utf8_general_ci
completion_type	NO_CHAIN
concurrent_insert	AUTO
connect_timeout	10
core_file	OFF
datadir	/application/mysql-5.6.39/data/
date_format	%Y-%m-%d
datetime_format	%Y-%m-%d %H:%i:%s
default_storage_engine	InnoDB
default_tmp_storage_engine	InnoDB
default_week_format	0
delay_key_write	ON
delayed_insert_limit	100
delayed_insert_timeout	300
delayed_queue_size	1000
disconnect_on_expired_password	ON
div_precision_increment	4
end_markers_in_json	OFF
enforce_gtid_consistency	OFF
eq_range_index_dive_limit	10
error_count	0
event_scheduler	OFF
expire_logs_days	0
explicit_defaults_for_timestamp	OFF
external_user	
flush	OFF
flush_time	0
foreign_key_checks	ON
ft_boolean_syntax	+ -><()~*:""&|
ft_max_word_len	84
ft_min_word_len	4
ft_query_expansion_limit	20
ft_stopword_file	(built-in)
general_log	OFF
general_log_file	/application/mysql-5.6.39/data/localhost.log
group_concat_max_len	1024
gtid_executed	
gtid_mode	OFF
gtid_next	AUTOMATIC
gtid_owned	
gtid_purged	
have_compress	YES
have_crypt	YES
have_dynamic_loading	YES
have_geometry	YES
have_openssl	DISABLED
have_profiling	YES
have_query_cache	YES
have_rtree_keys	YES
have_ssl	DISABLED
have_symlink	YES
host_cache_size	279
hostname	localhost.localdomain
identity	0
ignore_builtin_innodb	OFF
ignore_db_dirs	
init_connect	
init_file	
init_slave	
innodb_adaptive_flushing	ON
innodb_adaptive_flushing_lwm	10
innodb_adaptive_hash_index	ON
innodb_adaptive_max_sleep_delay	150000
innodb_additional_mem_pool_size	8388608
innodb_api_bk_commit_interval	5
innodb_api_disable_rowlock	OFF
innodb_api_enable_binlog	OFF
innodb_api_enable_mdl	OFF
innodb_api_trx_level	0
innodb_autoextend_increment	64
innodb_autoinc_lock_mode	1
innodb_buffer_pool_dump_at_shutdown	OFF
innodb_buffer_pool_dump_now	OFF
innodb_buffer_pool_filename	ib_buffer_pool
innodb_buffer_pool_instances	8
innodb_buffer_pool_load_abort	OFF
innodb_buffer_pool_load_at_startup	OFF
innodb_buffer_pool_load_now	OFF
innodb_buffer_pool_size	134217728
innodb_change_buffer_max_size	25
innodb_change_buffering	all
innodb_checksum_algorithm	innodb
innodb_checksums	ON
innodb_cmp_per_index_enabled	OFF
innodb_commit_concurrency	0
innodb_compression_failure_threshold_pct	5
innodb_compression_level	6
innodb_compression_pad_pct_max	50
innodb_concurrency_tickets	5000
innodb_data_file_path	ibdata1:12M:autoextend
innodb_data_home_dir	
innodb_disable_sort_file_cache	OFF
innodb_doublewrite	ON
innodb_fast_shutdown	1
innodb_file_format	Antelope
innodb_file_format_check	ON
innodb_file_format_max	Antelope
innodb_file_per_table	ON
innodb_flush_log_at_timeout	1
innodb_flush_log_at_trx_commit	1
innodb_flush_method	
innodb_flush_neighbors	1
innodb_flushing_avg_loops	30
innodb_force_load_corrupted	OFF
innodb_force_recovery	0
innodb_ft_aux_table	
innodb_ft_cache_size	8000000
innodb_ft_enable_diag_print	OFF
innodb_ft_enable_stopword	ON
innodb_ft_max_token_size	84
innodb_ft_min_token_size	3
innodb_ft_num_word_optimize	2000
innodb_ft_result_cache_limit	2000000000
innodb_ft_server_stopword_table	
innodb_ft_sort_pll_degree	2
innodb_ft_total_cache_size	640000000
innodb_ft_user_stopword_table	
innodb_io_capacity	200
innodb_io_capacity_max	2000
innodb_large_prefix	OFF
innodb_lock_wait_timeout	50
innodb_locks_unsafe_for_binlog	OFF
innodb_log_buffer_size	8388608
innodb_log_compressed_pages	ON
innodb_log_file_size	50331648
innodb_log_files_in_group	2
innodb_log_group_home_dir	./
innodb_lru_scan_depth	1024
innodb_max_dirty_pages_pct	75
innodb_max_dirty_pages_pct_lwm	0
innodb_max_purge_lag	0
innodb_max_purge_lag_delay	0
innodb_mirrored_log_groups	1
innodb_monitor_disable	
innodb_monitor_enable	
innodb_monitor_reset	
innodb_monitor_reset_all	
innodb_old_blocks_pct	37
innodb_old_blocks_time	1000
innodb_online_alter_log_max_size	134217728
innodb_open_files	2000
innodb_optimize_fulltext_only	OFF
innodb_page_size	16384
innodb_print_all_deadlocks	OFF
innodb_purge_batch_size	300
innodb_purge_threads	1
innodb_random_read_ahead	OFF
innodb_read_ahead_threshold	56
innodb_read_io_threads	4
innodb_read_only	OFF
innodb_replication_delay	0
innodb_rollback_on_timeout	OFF
innodb_rollback_segments	128
innodb_sort_buffer_size	1048576
innodb_spin_wait_delay	6
innodb_stats_auto_recalc	ON
innodb_stats_include_delete_marked	OFF
innodb_stats_method	nulls_equal
innodb_stats_on_metadata	OFF
innodb_stats_persistent	ON
innodb_stats_persistent_sample_pages	20
innodb_stats_sample_pages	8
innodb_stats_transient_sample_pages	8
innodb_status_output	OFF
innodb_status_output_locks	OFF
innodb_strict_mode	OFF
innodb_support_xa	ON
innodb_sync_array_size	1
innodb_sync_spin_loops	30
innodb_table_locks	ON
innodb_thread_concurrency	0
innodb_thread_sleep_delay	10000
innodb_tmpdir	
innodb_undo_directory	.
innodb_undo_logs	128
innodb_undo_tablespaces	0
innodb_use_native_aio	OFF
innodb_use_sys_malloc	ON
innodb_version	5.6.39
innodb_write_io_threads	4
insert_id	0
interactive_timeout	28800
join_buffer_size	262144
keep_files_on_create	OFF
key_buffer_size	8388608
key_cache_age_threshold	300
key_cache_block_size	1024
key_cache_division_limit	100
large_files_support	ON
large_page_size	0
large_pages	OFF
last_insert_id	0
lc_messages	en_US
lc_messages_dir	/application/mysql-5.6.39/share/
lc_time_names	en_US
license	GPL
local_infile	ON
lock_wait_timeout	31536000
locked_in_memory	OFF
log_bin	OFF
log_bin_basename	
log_bin_index	
log_bin_trust_function_creators	OFF
log_bin_use_v1_row_events	OFF
log_error	./localhost.localdomain.err
log_output	FILE
log_queries_not_using_indexes	OFF
log_slave_updates	OFF
log_slow_admin_statements	OFF
log_slow_slave_statements	OFF
log_throttle_queries_not_using_indexes	0
log_warnings	1
long_query_time	10.000000
low_priority_updates	OFF
lower_case_file_system	OFF
lower_case_table_names	0
master_info_repository	FILE
master_verify_checksum	OFF
max_allowed_packet	4194304
max_binlog_cache_size	18446744073709547520
max_binlog_size	1073741824
max_binlog_stmt_cache_size	18446744073709547520
max_connect_errors	100
max_connections	151
max_delayed_threads	20
max_digest_length	1024
max_error_count	64
max_heap_table_size	16777216
max_insert_delayed_threads	20
max_join_size	18446744073709551615
max_length_for_sort_data	1024
max_prepared_stmt_count	16382
max_relay_log_size	0
max_seeks_for_key	18446744073709551615
max_sort_length	1024
max_sp_recursion_depth	0
max_tmp_tables	32
max_user_connections	0
max_write_lock_count	18446744073709551615
metadata_locks_cache_size	1024
metadata_locks_hash_instances	8
min_examined_row_limit	0
multi_range_count	256
myisam_data_pointer_size	6
myisam_max_sort_file_size	9223372036853727232
myisam_mmap_size	18446744073709551615
myisam_recover_options	OFF
myisam_repair_threads	1
myisam_sort_buffer_size	8388608
myisam_stats_method	nulls_unequal
myisam_use_mmap	OFF
net_buffer_length	16384
net_read_timeout	30
net_retry_count	10
net_write_timeout	60
new	OFF
old	OFF
old_alter_table	OFF
old_passwords	0
open_files_limit	1000000
optimizer_prune_level	1
optimizer_search_depth	62
optimizer_switch	index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
optimizer_trace	enabled=off,one_line=off
optimizer_trace_features	greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on
optimizer_trace_limit	1
optimizer_trace_max_mem_size	16384
optimizer_trace_offset	-1
performance_schema	ON
performance_schema_accounts_size	100
performance_schema_digests_size	10000
performance_schema_events_stages_history_long_size	10000
performance_schema_events_stages_history_size	10
performance_schema_events_statements_history_long_size	10000
performance_schema_events_statements_history_size	10
performance_schema_events_waits_history_long_size	10000
performance_schema_events_waits_history_size	10
performance_schema_hosts_size	100
performance_schema_max_cond_classes	80
performance_schema_max_cond_instances	3504
performance_schema_max_digest_length	1024
performance_schema_max_file_classes	50
performance_schema_max_file_handles	32768
performance_schema_max_file_instances	7693
performance_schema_max_mutex_classes	200
performance_schema_max_mutex_instances	15906
performance_schema_max_rwlock_classes	40
performance_schema_max_rwlock_instances	9102
performance_schema_max_socket_classes	10
performance_schema_max_socket_instances	322
performance_schema_max_stage_classes	150
performance_schema_max_statement_classes	168
performance_schema_max_table_handles	4000
performance_schema_max_table_instances	12500
performance_schema_max_thread_classes	50
performance_schema_max_thread_instances	402
performance_schema_session_connect_attrs_size	512
performance_schema_setup_actors_size	100
performance_schema_setup_objects_size	100
performance_schema_users_size	100
pid_file	/application/mysql-5.6.39/data/localhost.localdomain.pid
plugin_dir	/application/mysql-5.6.39/lib/plugin/
port	3306
preload_buffer_size	32768
profiling	OFF
profiling_history_size	15
protocol_version	10
proxy_user	
pseudo_slave_mode	OFF
pseudo_thread_id	10
query_alloc_block_size	8192
query_cache_limit	1048576
query_cache_min_res_unit	4096
query_cache_size	1048576
query_cache_type	OFF
query_cache_wlock_invalidate	OFF
query_prealloc_size	8192
rand_seed1	0
rand_seed2	0
range_alloc_block_size	4096
read_buffer_size	131072
read_only	OFF
read_rnd_buffer_size	262144
relay_log	
relay_log_basename	
relay_log_index	
relay_log_info_file	relay-log.info
relay_log_info_repository	FILE
relay_log_purge	ON
relay_log_recovery	OFF
relay_log_space_limit	0
report_host	
report_password	
report_port	3306
report_user	
rpl_stop_slave_timeout	31536000
secure_auth	ON
secure_file_priv	NULL
server_id	0
server_id_bits	32
server_uuid	41ce72da-db03-11eb-81ab-0050562a973d
show_old_temporals	OFF
simplified_binlog_gtid_recovery	OFF
skip_external_locking	ON
skip_name_resolve	OFF
skip_networking	OFF
skip_show_database	OFF
slave_allow_batching	OFF
slave_checkpoint_group	512
slave_checkpoint_period	300
slave_compressed_protocol	OFF
slave_exec_mode	STRICT
slave_load_tmpdir	/tmp
slave_max_allowed_packet	1073741824
slave_net_timeout	3600
slave_parallel_workers	0
slave_pending_jobs_size_max	16777216
slave_rows_search_algorithms	TABLE_SCAN,INDEX_SCAN
slave_skip_errors	OFF
slave_sql_verify_checksum	ON
slave_transaction_retries	10
slave_type_conversions	
slow_launch_time	2
slow_query_log	OFF
slow_query_log_file	/application/mysql-5.6.39/data/localhost-slow.log
socket	/application/mysql-5.6.39/tmp/mysql.sock
sort_buffer_size	262144
sql_auto_is_null	OFF
sql_big_selects	ON
sql_buffer_result	OFF
sql_log_bin	ON
sql_log_off	OFF
sql_mode	STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
sql_notes	ON
sql_quote_show_create	ON
sql_safe_updates	OFF
sql_select_limit	18446744073709551615
sql_slave_skip_counter	0
sql_warnings	OFF
ssl_ca	
ssl_capath	
ssl_cert	
ssl_cipher	
ssl_crl	
ssl_crlpath	
ssl_key	
storage_engine	InnoDB
stored_program_cache	256
sync_binlog	0
sync_frm	ON
sync_master_info	10000
sync_relay_log	10000
sync_relay_log_info	10000
system_time_zone	CST
table_definition_cache	1400
table_open_cache	2000
table_open_cache_instances	1
thread_cache_size	9
thread_concurrency	10
thread_handling	one-thread-per-connection
thread_stack	262144
time_format	%H:%i:%s
time_zone	SYSTEM
timed_mutexes	OFF
timestamp	1626404833.208162
tmp_table_size	16777216
tmpdir	/tmp
transaction_alloc_block_size	8192
transaction_allow_batching	OFF
transaction_prealloc_size	4096
tx_isolation	REPEATABLE-READ
tx_read_only	OFF
unique_checks	ON
updatable_views_with_limit	YES
version	5.6.39
version_comment	Source distribution
version_compile_machine	x86_64
version_compile_os	Linux
wait_timeout	28800
warning_count	0

 

part7

#备份语句!!!
mysqldump --set-gtid-purged=OFF -h 192.168.1.94 -uroot -p -ntd -R op_qscdb > 01_op_qscdb_20210320.sql
mysqldump --set-gtid-purged=OFF -h 192.168.1.94 -uroot -p op_qscdb > 02_op_qscdb_20210320.sql

-n, --no-create-db  Suppress the CREATE DATABASE ... IF EXISTS statement that
                      normally is output for each dumped database if
                      --all-databases or --databases is given.
#不创建数据库

-t, --no-create-info 
                      Don't write table creation info.
#不创建表的创建信息
#这个选项使的mysqldump命令不创建CREATE TABLE语句,这个选项在您只需要数据而不需要DDL(数据库定义语句)时很方便。

-d, --no-data       No row information

#不创建数据(行)

--routines, -R 
#将使存储过程、函数也转储到文件中来

--opt 
#如果你正将数据移动到更新版本的MySQL,你应当使用mysqldump --opt来利用各种优化性能来产生更小、可以更快处理的转储文件


目的:保证先还原存储过程!!!再还原数据!!!

 

 

 

新学到的mysql命令(updating)
1 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Scroll to top
0
Would love your thoughts, please comment.x
()
x