

# 步骤 1：创建数据库
<a name="step-1-create-a-database"></a>

首先，您需要在 Athena 中创建一个数据库。

**创建 Athena 数据库**

1. 从 [https://console.aws.amazon.com/athena/](https://console.aws.amazon.com/athena/home) 打开 Athena 控制台。

1. 如果这是您首次在目前的 AWS 区域 中访问 Athena 控制台，选择 **Explore the query editor**（浏览查询编辑器）以打开查询编辑器。否则，Athena 会在查询编辑器中打开。

1. 选择 **Edit Settings**（编辑设置）以在 Amazon S3 中设置查询结果位置。  
![\[选择编辑设置。\]](http://docs.aws.amazon.com/zh_cn/athena/latest/ug/images/getting-started-choose-view-settings.png)

1. 对于 **Manage settings**（管理设置），执行以下操作之一：
   + 在 **Location of query result**（查询结果位置）文本框中，输入您在 Amazon S3 中为查询结果创建的存储桶路径。在路径前添加前缀 `s3://`。
   + 选择 **Browse S3**（浏览 S3），选择您为当前区域创建的 Amazon S3 存储桶，然后选择 **Choose**（选择）。  
![\[指定 Amazon S3 中的位置用于接收来自 Athena 的查询结果。\]](http://docs.aws.amazon.com/zh_cn/athena/latest/ug/images/getting-started-setting-results-location.png)

1. 选择**保存**。

1. 选择 **Editor**（编辑器）以切换到查询编辑器。  
![\[选择 Editor（编辑器）。\]](http://docs.aws.amazon.com/zh_cn/athena/latest/ug/images/getting-started-choose-editor.png)

1. 在导航窗格的右侧，您可以使用 Athena 查询编辑器输入和运行查询和语句。

1. 要创建一个名为 `mydatabase` 的数据库，请输入以下 CREATE DATABASE 语句。

   ```
   CREATE DATABASE mydatabase
   ```

1. 选择 **Run**（运行）或者按 **Ctrl\$1ENTER**。

1. 在左侧的 **Database**（数据库）列表中，选择 `mydatabase` 使其成为当前数据库。