mysql切换数据库提示警告:Reading table information for completion of table and column names

登录数据库后,选择数据库时发现以下提示,

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 ;    (查看进程)

mysql切换数据库提示警告:Reading table information for completion of table and column names

上图中锁表的id为16545618,则可以使用kill命令,结束它.

mysql> kill 16545618;

删除这些锁表的情况,我的mysql就能正常访问了。

上一篇:批处理程序:自动上传FTP,再登陆linux服务器执行更新


下一篇:msyql error: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A