Sqoop 简明教程

Sqoop - List Databases

本章描述了如何使用 Sqoop 列出数据库。Sqoop list-databases 工具解析和执行针对数据库服务器的“SHOW DATABASES”查询。之后,它会列出服务器上的当前数据库。

This chapter describes how to list out the databases using Sqoop. Sqoop list-databases tool parses and executes the ‘SHOW DATABASES’ query against the database server. Thereafter, it lists out the present databases on the server.

Syntax

Sqoop list-databases 命令使用了以下语法。

The following syntax is used for Sqoop list-databases command.

$ sqoop list-databases (generic-args) (list-databases-args)
$ sqoop-list-databases (generic-args) (list-databases-args)

Sample Query

以下命令用于列出 MySQL 数据库服务器中的所有数据库。

The following command is used to list all the databases in the MySQL database server.

$ sqoop list-databases \
--connect jdbc:mysql://localhost/ \
--username root

如果命令执行成功,它将像下面一样在您的 MySQL 数据库服务器中显示数据库列表。

If the command executes successfully, then it will display the list of databases in your MySQL database server as follows.

...
13/05/31 16:45:58 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.

mysql
test
userdb
db