> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/integrations/resource-integrations/mysql/installation.md).

# Installation

Follow this guide to install P0 on an AWS-RDS-managed MySQL instance or cluster. P0 treats individual MySQL instances, MariaDB instances, and Aurora MySQL clusters in the same manner.

### Prerequisites

Before you begin, ensure you have

* Admin access to the database instance (or cluster)
* IAM authentication enabled on the database instance (or cluster)
* AWS permissions that allow you to create IAM policies, and grant those policies to roles
* AWS permissions that allow you to create ECR repositories, add images to that repository, create Lambda functions, and create VPC endpoints and security groups within the database's VPC
* A P0 [AWS RDS](/integrations/resource-integrations/aws/managed-services/aws-rds.md) integration installed on the VPC that hosts the database

### Installation

Follow these steps to install P0 on a MySQL instance or cluster

#### Via the P0 app

1. Navigate to **Integrations > MySQL** in the P0 app
2. Select the **Access management** component
3. Click **Add instance**
4. Enter a unique identifier for the instance (this can be any value you like)
5. Choose **AWS RDS** hosting
   1. Enter the ARN of the AWS RDS instance
   2. Select the installed P0 AWS RDS VPC integration
6. Click **Next**
7. Run the supplied SQL command in the MySQL instance
8. Run the supplied Terraform to deploy the P0 connector
9. Click **Next**
10. If desired, configure the port and default database for this instance
11. Click **Finish**

#### Via the P0 Terraform provider

1. Run the following SQL in the Aurora MySQL database to create the admin user.

   ```sql
   CREATE USER p0_iam_manager IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';
   GRANT CREATE USER, CREATE ROLE ON *.* TO p0_iam_manager;
   GRANT ROLE_ADMIN ON *.* TO p0_iam_manager;
   GRANT ALL PRIVILEGES ON `%`.* TO p0_iam_manager WITH GRANT OPTION;
   ```
2. Ensure you have a configure P0 Terraform provider (follow the provider docs at <https://registry.terraform.io/providers/p0-security/p0/latest/docs> to configure).
3. Use the example module definition at <https://registry.terraform.io/providers/p0-security/p0/latest/docs/resources/mysql> to configure P0's access to your environment.
4. Run `terraform init` and `terraform apply`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.p0.dev/integrations/resource-integrations/mysql/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
