登录数据库后,use db很慢的问题

Posted HarveyB

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了登录数据库后,use db很慢的问题相关的知识,希望对你有一定的参考价值。

mysql> use dbl
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

登录时出现这种情况,一般是有大量库,表,字段需要扫描,会很慢,登录库时可以加上-A参数不进行预读,速度会很快。

 

参考http://dba.stackexchange.com/questions/62102/mysql-database-freezing-after-use/62103

On the first "use" command after login, MySQL scans database, tables and columns name for auto completion. If you have many db, tables it could take a while.

To avoid that, launch your client with the -A option (or --no-auto-rehash)

mysql>mysql -uroot -p -A</CODE>

You could also add the disable_auto_rehash variable in your my.cnf (in the [mysql] section) if you want to disable it completely. This change does not require a reboot (it is a client, not server, variable).

以上是关于登录数据库后,use db很慢的问题的主要内容,如果未能解决你的问题,请参考以下文章

sqlplus / as sysdba登录很慢的问题

解决远程连接mysql很慢的方法

解决远程连接mysql很慢的方法

mysql大量数据插入慢的问题

IIS进程回收后第一次访问慢的问题

[转]解决远程连接mysql很慢的方法