如何确定 MySQL 中当前的分隔符?


要确定 MySQL 中当前的分隔符,请使用以下语法

\s

以上语法将让你了解当前的分隔符。我们来实现以上语法。

查询如下

mysql> \s

以下为输出结果

--------------
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)
Connection id: 19
Current database: sample
Current user: root@localhost
SSL: Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter: ;
Server version: 8.0.12 MySQL Community Server - GPL
Protocol version: 10
Connection: localhost via TCP/IP
Insert id: 11
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 9 hours 50 min 52 sec
Threads: 3 Questions: 135 Slow queries: 0 Opens: 272 Flush tables: 2 Open tables: 247 Queries per second avg: 0.003
--------------

如果你更改了分隔符,那么它将显示更新后的当前分隔符。

我们来将当前分隔符更改为 //.

语法如下

DELIMITER //

用于更改分隔符的查询如下

mysql> DELIMITER //

现在让我们检查当前的,即更新后的分隔符。

查询如下

mysql> \s

The following is the output

--------------
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)
Connection id: 19
Current database: sample
Current user: root@localhost
SSL: Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter: //
Server version: 8.0.12 MySQL Community Server - GPL
Protocol version: 10
Connection: localhost via TCP/IP
Insert id: 11
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 9 hours 54 min 10 sec
Threads: 3 Questions: 138 Slow queries: 0 Opens: 272 Flush tables: 2 Open tables: 247 Queries per second avg: 0.003
--------------

更新于: 2019 年 7 月 30 日

529 次浏览

开启你的 职业生涯

完成课程即可获得认证

开始学习
广告