签到成功

知道了

CNDBA社区CNDBA社区

MySQL -A不预读数据库信息(use dbname 更快)

2021-11-06 12:53 948 0 原创 mysql
作者: hbhe0316

mysql数据库预读与不预读数据库信息(use dbname)—Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

http://www.cndba.cn/hbhe0316/article/5043
http://www.cndba.cn/hbhe0316/article/5043

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

让后就卡在这里。http://www.cndba.cn/hbhe0316/article/5043

上面卡住的原因:是由于数据库太大,即数据库中表非常多,所以如果预读数据库信息,将非常慢,所以就卡住了,如果数据库中表非常少,将不会出现问题。

出现问题的原因是::
我们进入mysql 时,没有使用-A参数;http://www.cndba.cn/hbhe0316/article/5043http://www.cndba.cn/hbhe0316/article/5043

http://www.cndba.cn/hbhe0316/article/5043

1.加-A参数进入数据库

http://www.cndba.cn/hbhe0316/article/5043

[root@mysql8 ~]#  mysql -uroot -pwwwwww -A -e "use testdb;select * from t1;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------+
| id   |
+------+
|    1 |
+------+

2.不加-A参数进入数据库
当我们打开数据库,即use dbname时,要预读数据库信息,当使用-A参数时,就不预读数据库信息。http://www.cndba.cn/hbhe0316/article/5043

[root@mysql8 ~]#  mysql -uroot -pwwwwww -e "use testdb;select * from t1;"
mysql: [Warning] Using a password on the command line interface can be insecure.
+------+
| id   |
+------+
|    1 |
+------+

总结:http://www.cndba.cn/hbhe0316/article/5043

http://www.cndba.cn/hbhe0316/article/5043

当数据库中表非常多,如果预读数据库信息,将非常慢,可能会卡住,如果数据库中表非常少,将不会出现问题。
正确的打开方式是: mysql -hhostname -uusername -ppassword -Pport -A的方式进入数据库。

版权声明:本文为博主原创文章,未经博主允许不得转载。

MYSQL

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:1039235次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ