ITPub博客

首页 > 数据库 > MySQL > use database 切换提示You can turn off this feature to get a quicker startup

use database 切换提示You can turn off this feature to get a quicker startup

MySQL 作者:dba_sam 时间:2021-06-29 21:50:10 1 删除 编辑

use database 很慢/You can turn off this feature to get a quicker startup with –A


mysql> use information_schema
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


当切换到某个库时,经常会出现上面信息,意思是预读这个库中表以及表列信息。

但是当库中表很多,表中数据很大时,就会出现执行use <库名>后半天没反应,连接很慢的情况

 

解决办法:

上面其实已经有提示了(You can turn off this feature to get a quicker startup with -A)

就是在登陆连接mysql时使用-A参数,这样就不会预读库中表信息了,能提高连接库的速度.

 

shell> mysql -h hostname -u username -P port -p -A

Enter password:

MySQL -A参数含义:

shell> mysql --help

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

 

例子:

shell> mysql -h 127.0.0.1 -u root -P 3306 -p

Enter password:

mysql> use information_schema;
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> exit
Bye


shell> mysql -h 127.0.0.1 -u root -P 3306 -p

Enter password:

mysql> use information_schema;
Database changed        


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/70000068/viewspace-2777491/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
本人从事oracle、mysql、postgresql等数据库管理多年,具备丰富的实战经验,同时维护大型企业的Linux操作系统、vmware虚拟化、openstack云计算平台,具有部署、优化、故障处理等经验。

注册时间:2021-05-16

  • 博文量
    49
  • 访问量
    24934