文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.5 NDB 集群程序 / 25.5.25 ndb_select_all — 从 NDB 表中打印行
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 71%

25.5.25 ndb_select_all — 打印 NDB 表中的行25.5.25 ndb_select_all — Print Rows from an NDB Table

ndb_select_all 将 NDB 表中的所有行打印到 stdout。ndb_select_all prints all rows from an NDB table to stdout.

用法Usage

ndb_select_all -c connection_string tbl_name -d db_name [> file_name]

可以与ndb_select_all一起使用的选项如下表所示。表格之后有附加说明。Options that can be used with ndb_select_all are shown in the following table. Additional descriptions follow the table.

  • --character-sets-dir

    命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path

    包含字符集的目录。Directory containing character sets.

  • --connect-retries

    命令行格式Command-Line Format --connect-retries=#
    类型Type 整数Integer
    默认值Default Value 12
    最小值Minimum Value 0
    最大值Maximum Value 12

    放弃之前重试连接的次数。Number of times to retry connection before giving up.

  • --connect-retry-delay

    命令行格式Command-Line Format --connect-retry-delay=#
    类型Type 整数Integer
    默认值Default Value 5
    最小值Minimum Value 0
    最大值Maximum Value 5

    尝试联系管理服务器之间等待的秒数。Number of seconds to wait between attempts to contact management server.

  • --connect-string

    命令行格式Command-Line Format --connect-string=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    与 --ndb-connectstring 相同。Same as --ndb-connectstring.

  • --core-file

    命令行格式Command-Line Format --core-file

    错误时生成核心文件;用于调试。Write core file on error; used in debugging.

  • --database=dbname, -d dbname

    表所在的数据库名称。默认值为 TEST_DB。Name of the database in which the table is found. The default value is TEST_DB.

  • --descending, -z

    按降序排列输出。此选项只能与 -o (--order) 选项一起使用。Sorts the output in descending order. This option can be used only in conjunction with the -o (--order) option.

  • --defaults-extra-file

    命令行格式Command-Line Format --defaults-extra-file=path--defaults-extra-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    在读取全局文件之后读取给定文件。Read given file after global files are read.

  • --defaults-file

    命令行格式Command-Line Format --defaults-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    仅从指定文件读取默认选项。Read default options from given file only.

  • --defaults-group-suffix

    命令行格式Command-Line Format --defaults-group-suffix=string
    类型Type 字符串String
    默认值Default Value [none][none]

    也读取组合了 concat(group, suffix) 的组。Also read groups with concat(group, suffix).

  • --delimiter=character, -D character

    指定使用character作为列分隔符。只有表数据列会被此分隔符分隔。Causes the character to be used as a column delimiter. Only table data columns are separated by this delimiter.

    默认的分隔符是制表符。The default delimiter is the tab character.

  • --disk

    在输出中添加一个磁盘引用列。该列仅在具有非索引列的磁盘表中非空。Adds a disk reference column to the output. The column is nonempty only for Disk Data tables having nonindexed columns.

  • --gci

    在输出中添加一个 GCI 列,显示每行最后更新时的全局检查点。有关检查点的更多信息,请参见 第 25.2 节,“NDB Cluster 概述” 和 第 25.6.3.2 节,“NDB Cluster 日志事件”。Adds a GCI column to the output showing the global checkpoint at which each row was last updated. See Section 25.2, “NDB Cluster Overview”, and Section 25.6.3.2, “NDB Cluster Log Events”, for more information about checkpoints.

  • --gci64

    在输出中添加一个 ROW$GCI64 列,显示每行最后更新时的全局检查点,以及该更新发生的时期号。Adds a ROW$GCI64 column to the output showing the global checkpoint at which each row was last updated, as well as the number of the epoch in which this update occurred.

  • --help

    命令行格式Command-Line Format --help--help

    显示帮助文本并退出。Display help text and exit.

  • --lock=lock_type, -l lock_type

    在读取表时使用锁。lock_type 的可能值为:Employs a lock when reading the table. Possible values for lock_type are:

    • 0:读锁0: Read lock

    • 1:带保持的读锁1: Read lock with hold

    • 2:独占读锁2: Exclusive read lock

    此选项没有默认值。There is no default value for this option.

  • --login-path

    命令行格式Command-Line Format --login-path=path
    类型Type 字符串String
    默认值Default Value [none][none]

    从登录文件读取给定路径。Read given path from login file.

  • --no-login-paths

    命令行格式Command-Line Format --no-login-paths

    跳过从登录路径文件读取选项。Skips reading options from the login path file.

  • --header=FALSE

    从输出中排除列标题。Excludes column headers from the output.

  • --nodata

    导致省略任何表数据。Causes any table data to be omitted.

  • --ndb-connectstring

    命令行格式Command-Line Format --ndb-connectstring=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    设置用于连接到 ndb_mgmd 的连接字符串。语法:[nodeid=id;][host=]hostname[:port]。覆盖 NDB_CONNECTSTRING 和 my.cnf 中的条目。Set connection string for connecting to ndb_mgmd. Syntax: [nodeid=id;][host=]hostname[:port]. Overrides entries in NDB_CONNECTSTRING and my.cnf.

  • --ndb-mgm-tls

    命令行格式Command-Line Format --ndb-mgm-tls=level
    类型Type 枚举Enumeration
    默认值Default Value relaxedrelaxed
    有效值Valid Values

    relaxedrelaxed

    strictstrict

    设置连接到管理服务器所需的 TLS 支持级别;可以是 relaxed 或 strict。relaxed(默认)表示尝试建立 TLS 连接,但不要求成功;strict表示连接必须使用 TLS。Sets the level of TLS support required to connect to the management server; one of relaxed or strict. relaxed (the default) means that a TLS connection is attempted, but success is not required; strict means that TLS is required to connect.

  • --ndb-mgmd-host

    命令行格式Command-Line Format --ndb-mgmd-host=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    与 --ndb-connectstring 相同。Same as --ndb-connectstring.

  • --ndb-nodeid

    命令行格式Command-Line Format --ndb-nodeid=#
    类型Type 整数Integer
    默认值Default Value [none][none]

    为此节点设置节点 ID,覆盖由 --ndb-connectstring 设置的任何 ID。Set node ID for this node, overriding any ID set by --ndb-connectstring.

  • --ndb-optimized-node-selection

    命令行格式Command-Line Format --ndb-optimized-node-selection

    启用事务节点选择的优化。默认启用;使用 --skip-ndb-optimized-node-selection 来禁用。Enable optimizations for selection of nodes for transactions. Enabled by default; use --skip-ndb-optimized-node-selection to disable.

  • --ndb-tls-search-path

    命令行格式Command-Line Format --ndb-tls-search-path=list
    类型Type 路径名Path name
    默认值(Unix)Default Value (Unix) $HOME/ndb-tls$HOME/ndb-tls
    默认值(Windows)Default Value (Windows) $HOMEDIR/ndb-tls

    指定用于搜索 CA 文件的目录列表。在 Unix 平台上,目录名称用冒号 (:) 分隔;在 Windows 系统上,使用分号 (;) 作为分隔符。目录引用可以是相对路径或绝对路径;它可以包含一个或多个环境变量,每个变量以美元符号 ($) 开头,并在使用前进行展开。Specify a list of directories to search for a CA file. On Unix platforms, the directory names are separated by colons (:); on Windows systems, the semicolon character (;) is used as the separator. A directory reference may be relative or absolute; it may contain one or more environment variables, each denoted by a prefixed dollar sign ($), and expanded prior to use.

    搜索从最左边的命名目录开始,按从左到右的顺序进行,直到找到文件。空字符串表示空搜索路径,这会导致所有搜索失败。由单个点 (.) 组成的字符串表示搜索路径仅限于当前工作目录。Searching begins with the leftmost named directory and proceeds from left to right until a file is found. An empty string denotes an empty search path, which causes all searches to fail. A string consisting of a single dot (.) indicates that the search path limited to the current working directory.

    如果未提供搜索路径,则使用编译时的默认值。此值取决于所使用的平台:在 Windows 上,它是 \ndb-tls;在其他平台(包括 Linux)上,它是 $HOME/ndb-tls。可以通过使用 -DWITH_NDB_TLS_SEARCH_PATH 编译 NDB Cluster 来覆盖该值。If no search path is supplied, the compiled-in default value is used. This value depends on the platform used: On Windows, this is \ndb-tls; on other platforms (including Linux), it is $HOME/ndb-tls. This can be overridden by compiling NDB Cluster using -DWITH_NDB_TLS_SEARCH_PATH.

  • --no-defaults

    命令行格式Command-Line Format --no-defaults--no-defaults

    除了登录文件之外,不从任何配置文件读取默认选项。Do not read default options from any option file other than login file.

  • --order=index_name, -o index_name

    按名为 index_name 的索引排序输出。Orders the output according to the index named index_name.

    Note

    这是索引的名称,而不是列的名称;索引在创建时必须被明确命名。This is the name of an index, not of a column; the index must have been explicitly named when created.

  • parallelism=#, -p #

    指定并行度。Specifies the degree of parallelism.

  • --print-defaults

    命令行格式Command-Line Format --print-defaults

    打印程序参数列表然后退出。Print program argument list and exit.

  • --rowid

    添加一个ROWID列,提供有关行存储片段的信息。Adds a ROWID column providing information about the fragments in which rows are stored.

  • --tupscan, -t

    按元组顺序扫描表。Scan the table in the order of the tuples.

  • --usage

    命令行格式Command-Line Format --usage

    显示帮助文本并退出;与 --help 相同。Display help text and exit; same as --help.

  • --useHexFormat -x

    使所有数值以十六进制格式显示。这不会影响字符串或日期时间值中包含的数字的输出。Causes all numeric values to be displayed in hexadecimal format. This does not affect the output of numerals contained in strings or datetime values.

  • --version

    命令行格式Command-Line Format --version

    显示版本信息并退出。Display version information and exit.

示例输出Sample Output

来自 MySQL SELECT 语句的输出:Output from a MySQL SELECT statement:

mysql> SELECT * FROM ctest1.fish;
+----+-----------+
| id | name      |
+----+-----------+
|  3 | shark     |
|  6 | puffer    |
|  2 | tuna      |
|  4 | manta ray |
|  5 | grouper   |
|  1 | guppy     |
+----+-----------+
6 rows in set (0.04 sec)

来自等效调用 ndb_select_all 的输出:Output from the equivalent invocation of ndb_select_all:

$> ./ndb_select_all -c localhost fish -d ctest1
id      name
3       [shark]
6       [puffer]
2       [tuna]
4       [manta ray]
5       [grouper]
1       [guppy]
6 rows returned

在 ndb_select_all 的输出中,所有字符串值都用方括号 ([...]) 括起来。另一个示例,请参考此处创建并填充的表:All string values are enclosed by square brackets ([...]) in the output of ndb_select_all. For another example, consider the table created and populated as shown here:

CREATE TABLE dogs (
    id INT(11) NOT NULL AUTO_INCREMENT,
    name VARCHAR(25) NOT NULL,
    breed VARCHAR(50) NOT NULL,
    PRIMARY KEY pk (id),
    KEY ix (name)
)
TABLESPACE ts STORAGE DISK
ENGINE=NDBCLUSTER;

INSERT INTO dogs VALUES
    ('', 'Lassie', 'collie'),
    ('', 'Scooby-Doo', 'Great Dane'),
    ('', 'Rin-Tin-Tin', 'Alsatian'),
    ('', 'Rosscoe', 'Mutt');

这演示了几个附加的 ndb_select_all 选项的使用:This demonstrates the use of several additional ndb_select_all options:

$> ./ndb_select_all -d ctest1 dogs -o ix -z --gci --disk
GCI     id name          breed        DISK_REF
834461  2  [Scooby-Doo]  [Great Dane] [ m_file_no: 0 m_page: 98 m_page_idx: 0 ]
834878  4  [Rosscoe]     [Mutt]       [ m_file_no: 0 m_page: 98 m_page_idx: 16 ]
834463  3  [Rin-Tin-Tin] [Alsatian]   [ m_file_no: 0 m_page: 34 m_page_idx: 0 ]
835657  1  [Lassie]      [Collie]     [ m_file_no: 0 m_page: 66 m_page_idx: 0 ]
4 rows returned