mysql Enable automatic rehashing方式登陆hang问题

登陆myql数据库的crmdb  schema一直hang:

# mysql -uroot -proot_beehive -Dcrmdb
Warning: Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

查询进程:



# mysql -uroot -proot_beehive
.......

mysql> show processlist;
+------+------+---------------------+--------------------+------------+------+---------------------------------+------------------------------------------------------------------------------------------------------+-----------+---------------+
| Id   | User | Host                | db                 | Command    | Time | State                           | Info                                                                                                 | Rows_sent | Rows_examined |
+------+------+---------------------+--------------------+------------+------+---------------------------------+------------------------------------------------------------------------------------------------------+-----------+---------------+
| 8073 | root | localhost           | crmdb              | Query      | 4284 | Sending data                    | create table offer_2_party_bk2 as select a.offer_id,a.atom_action_id,a.party_id,a.start_dt,a.end_dt, |         0 |             0 |
| 8075 | root | localhost           | mysql              | Sleep      |  487 |                                 | NULL                                                                                                 |         0 |             0 |
| 8079 | root | localhost           | crmdb              | Field List | 2775 | Waiting for table metadata lock |                                                                                                      |         0 |             0 |
| 8082 | crm  | 132.228.47.137:3947 | information_schema | Sleep      | 1698 |                                 | NULL                                                                                                 |         0 |             0 |
| 8084 | root | localhost           | crmdb              | Field List |  274 | Waiting for table metadata lock |                                                                                                      |         0 |             0 |
| 8085 | root | localhost           | NULL               | Query      |    0 | init                            | show processlist                                                                                     |         0 |             0 |
+------+------+---------------------+--------------------+------------+------+---------------------------------+------------------------------------------------------------------------------------------------------+-----------+---------------+

看到一个元数据锁等待,执行一个field list的命令。

在上面hang之前提示使用-A 选项登陆mysql:

[root@bssmysqlcsdb02 ~]# mysql --help
mysql  Ver 14.14 Distrib 5.6.19-67.0, for Linux (x86_64) using  EditLine wrapper
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, 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.


Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
  -I, --help          Synonym for -?
  --auto-rehash       Enable automatic rehashing. One doesn't need to use
                      'rehash' to get table and field completion, but startup
                      and reconnecting may take a longer time. Disable with
                      --disable-auto-rehash.
                      (Defaults to on; use --skip-auto-rehash to disable.)
  -A, --no-auto-rehash 
                      No automatic rehashing. One has to use 'rehash' to get
                      table and field completion. This gives a quicker start of
                      mysql and disables rehashing on reconnect.

automatic rehashing实际上相当于tab键的提示,默认情况下,加-Dcrmdb会加载元数据,提供tab提示:

# mysql -uroot -proot_beehive -Dcrmdb --auto-rehash

......

mysql> select offer_   --按tab键

-------------------------------------------------------------提示
offer_id                     offer_member.bill_start_dt   offer_member.end_dt          offer_member.offer_member_id offer_member.status_dt      
offer_member                 offer_member.bss_end_dt      offer_member.member_id       offer_member.offer_role_id   offer_member.version        
offer_member.atom_action_id  offer_member.bss_start_dt    offer_member.obj_type        offer_member.start_dt        offer_member_id             
offer_member.bill_end_dt     offer_member.create_dt       offer_member.offer_id        offer_member.status_cd       offer_role_id   

这就是所谓的automatic rehashing





你可能感兴趣的:(mysql)