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