MySQL 執行 'use databases;' 時很慢



問題描述:

  就是這么個情況,登錄數據庫切換庫時感覺很卡,需要等待幾秒鍾。

案例:

shell > mysql -uroot -ppassword

mysql> use databases;
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>

# 當數據庫中表比較多,且單表又比較大時,執行這個 use databases 指令就會很卡 ( 也跟機器性能有很大關系 )

解決方法:

# 這時就可以按照提示,連接時加入 -A 參數

shell > mysql -A -uroot -ppassword

mysql> use databases;
Database changed

# 這樣就很快了,簡直快的飛起。

參數解釋:

-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.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM