凤凰平台注册开户_凤凰彩票app下载安装_凤凰彩票投注网

热门关键词: 凤凰平台注册开户,凤凰彩票app下载安装,凤凰彩票投注网

prompt贰个特意好用的一声令下,mysql切换数据库提

作者: MySQL数据库  发布:2019-11-05

    登录数据库后,选拔数据库时意识以下提醒,

或然大家在命令行操作mysql的时候会足够悄然现在的操作的是相当数据库吧,最少本身就郁结过,大概你会说自家打一条命令不就知晓了,是的如此做真正能够的。
但是前几日给大家介绍个好用的授命--prompt

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>

[root@fsailing1 ~]# mysql -uroot -p --prompt="\u@\h:\d \r:\m:\s>"
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 378
Server version: 5.0.95 Source distribution

    意思是 预读那些库中表以至表列音讯,常常原因是当库中表超级多,表中多少相当的大时,就能鬼使神差推行use <库名>后半天没影响,连接超慢的意况,驱除办法便是 -A 情势登陆数据库,不会预读库中表消息。

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

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

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Enter password:

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

(eg:shell> mysql -h 127.0.0.1 -u root -P 3306 -p -A)

root@localhost:(none) 08:23:32>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

本机登入数据库,间接实践-A也是足以的。

Database changed
root@localhost:test 08:23:44>exit;

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)

你也能够在在my.cnf配置文件里开展示公布局:

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.

[mysql]
prompt=mysql(\u@\h:\d)>

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

default-character-set=utf8

mysql> use test
Database changed
mysql>

复制代码 代码如下:

另意气风发种境况,不能切换访谈数据库,提醒此音讯。(作者没境遇过,后生可畏并贴过来询问下卡塔尔国

[root@fsailing1 ~]# vim /etc/my.cnf
[root@fsailing1 ~]# service mysqld restart
停止 MySQL:                                               [确定]
启动 MySQL:                                               [确定]
[root@fsailing1 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.0.95 Source distribution

是因为MYSQL中数据库太大,以致读取预读时间太长,进而呈现那个提醒,假若以前都并未有高出这一个难题,那么发生那么些主题素材的缘故恐怕是由于有改造数据库音讯的操作,譬喻drop三个非常大的表(几千万数码)而中途终止.

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

mysql> show processlist ;    (查看进程卡塔 尔(阿拉伯语:قطر‎

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

图片 1

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

上图中锁表的id为16545618,则足以接纳kill命令,结束它.

mysql(root@localhost:(none))>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

mysql> kill 16545618;

Database changed
mysql(root@localhost:test)>

去除这几个锁表的场地,小编的mysql就能够健康访谈了。

那边也付出要求的风姿浪漫对个选项供大家仿效。

 

Option Description
c A counter that increments for each statement you issue
D The full current date
d The default database
h The server host
l The current delimiter (new in 5.1.12)
m Minutes of the current time
n A newline character
O The current month in three-letter format (Jan, Feb, …)
o The current month in numeric format
P am/pm
p The current TCP/IP port or socket file
R The current time, in 24-hour military time (0–23)
r The current time, standard 12-hour time (1–12)
S Semicolon
s Seconds of the current time
t A tab character
U

Your full user_name@host_name account name

u Your user name
v The server version
w The current day of the week in three-letter format (Mon, Tue, …)
Y The current year, four digits
y The current year, two digits
_ A space
  A space (a space follows the backslash)
' Single quote
" Double quote
\ A literal “” backslash character
x

x, for any “x” not listed above

本文由凤凰平台注册开户发布于MySQL数据库,转载请注明出处:prompt贰个特意好用的一声令下,mysql切换数据库提

关键词: