mysql切换table_mysql切换数据库提示:Reading table information for completion of table and column names的解决方法...
登录数据库后,选择数据库时发现以下提示,mysql> use testReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql>意思是 预读这个库
登录数据库后,选择数据库时发现以下提示,
mysql> use test
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 后半天没反应,连接很慢的情况,解决办法就是 -A 方式登录数据库,不会预读库中表信息。
shell> mysql -h hostname -u username -P port -p -A
Enter password:
(eg:shell> mysql -h 127.0.0.1 -u root -P 3306 -p -A)
本机登录数据库,直接执行-A也是可以的。
mysql> use test;
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> q
Bye
[root@localhost ~]# mysql -u root -p -A
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 12
Server version: 5.7.23 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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 test
Database changed
mysql>
另一种情况,无法切换访问数据库,提示此信息。(我没遇到过,一并贴过来了解下)
由于MYSQL中数据库太大,导致读取预读时间太长,从而显示这个提示,如果之前都没有遇到这个问题,那么产生这个问题的原因可能是由于有改变数据库信息的操作,比如drop一个很大的表(几千万数据)而中途终止.
mysql> show processlist ; (查看进程)

上图中锁表的id为16545618,则可以使用kill命令,结束它.
mysql> kill 16545618;
删除这些锁表的情况,我的mysql就能正常访问了。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)