> ## Documentation Index
> Fetch the complete documentation index at: https://oxy.tech/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL

This guide explains how to connect to MySQL databases with Oxygen. MySQL is one of the world's most popular open-source relational database management systems.

## Configuration Options

Add your MySQL configuration to `config.yml`. Here are all available parameters:

```yaml theme={null}
databases:
  - name: my_mysql_db # Unique identifier for this connection
    type: mysql
    host: "localhost" # MySQL server hostname or IP
    port: "3306" # Port number (default: 3306)
    user: "root" # Username for authentication
    password: <password> # Direct password (not recommended)
    password_var: "MYSQL_PWD" # Environment variable containing password (recommended)
    database: "default" # Database name to connect to
```

## Example Configurations

<Steps>
  <Step title="Prepare password environment variable">
    Export the environment variable:

    ```sh theme={null}
    export MYSQL_PWD=<your password>
    ```

    Or put it in `.env` file:

    ```sh theme={null}
    echo MYSQL_PWD=<your password> >> .env
    ```
  </Step>

  <Step title="Add MySQL configuration">
    ```yaml theme={null}
    databases:
      - name: local_db
        type: mysql
        host: "localhost"
        port: "3306"
        user: "dev_user"
        password_var: "MYSQL_PWD"
        database: "development"
    ```
  </Step>
</Steps>

## Troubleshooting

* Verify MySQL server is running: `mysqladmin ping`
* Check connectivity: `mysql -h hostname -u username -p`
* Common ports: 3306 (default), 33060 (X Protocol)
* Ensure user has proper permissions: `SHOW GRANTS`
