# sqlalchemy.exc.ArgumentError: Invalid argument(s) 'charset' sent to create_engine(), using configuration create_engine(). Did you mean to use 'connect_args'?

- **ID:** `python/mysql-wrong-argument`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

将数据库驱动特有的参数直接传递给 create_engine，而不是通过 connect_args。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.4.x | active | — | — |
| 2.0.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   使用 connect_args：create_engine(url, connect_args={'charset': 'utf8mb4'})
   ```
2. **** (85% success)
   ```
   在 URL 中正确编码，例如：mysql+pymysql://user:pass@host/db?charset=utf8mb4
   ```

## Dead Ends

- **** — 尝试在 URL 中直接添加 charset，但可能被忽略。 (50% fail)
- **** — 删除 charset 参数，但可能导致编码问题。 (40% fail)
