自動補齊

  1. mysql 5.5 版本登入後,下命令 use database 使用某資料庫時,例如以下 use dbx; 出現訊息 Reading.....,此為自動補齊功能提示,如果不使用以加快執行速度,可以登入時使用 -A 選項關閉。
    mysql> use dbx;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
  2. 登入 mysql 後,使用 dbx 資料庫,執行 select * from tbl[TAB] 出現提示。
    [root@kvm6 ~]# mysql -uroot -p123qwe 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 20
    Server version: 5.5.49 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2016, 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.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> use dbx;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> select * from tbl[TAB]
    tbl321                  tbl321.id               tbly
    tbl321.author           tbl321.submission_date  tbly.author
    tbl321.fc2              tbl321.title            tbly.count
    mysql> select * from tbl321;
    +-----+----+-------+--------+-----------------+
    | fc2 | id | title | author | submission_date |
    +-----+----+-------+--------+-----------------+
    |   0 | 10 | linux | abc123 | 2015-04-01      |
    |   0 | 12 | shell | xyz222 | 2015-04-03      |
    |   0 | 14 | ruby  | xyz111 | 2015-05-02      |
    +-----+----+-------+--------+-----------------+
    3 rows in set (0.00 sec)
    
    mysql> exit
    Bye
    
  3. 查詢 mysql 選項,-A, --no-auto-rehash 沒有自動補齊功能。
    [root@kvm6 ~]# mysql --help | grep '\-A'
      -A, --no-auto-rehash
    
  4. 以 -A 選項關閉自動補齊功能,登入 mysql 後,使用 dbx 資料庫,執行 select * from tbl[TAB] 無法出現提示。
    [root@kvm6 ~]# mysql -uroot -p123qwe -A
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 21
    Server version: 5.5.49 MySQL Community Server (GPL) by Remi
    
    Copyright (c) 2000, 2016, 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.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> use dbx;
    Database changed
    mysql> select * from tbl[TAB]
        -> ;
    ERROR 1146 (42S02): Table 'dbx.tbl' doesn't exist
    mysql> exit
    Bye