Skip to main content
Version: 6.1.0
MySQL is a popular open-source relational database.
Installation
Required packages: mysqlclient
Drivers
PyPI Package: mysqlclient
mysql://{username}:{password}@{host}/{database}
Supported Features
JOINsSubqueriesDynamic SchemaCatalog SupportDynamic CatalogSSH TunnelingQuery CancellationFile UploadUser ImpersonationCost EstimationSQL Validation
Feature Score: 59/201
Time Grains
Common Time Grains:
SECONDMINUTEHOURDAYWEEKMONTHQUARTERYEAR
Extended Time Grains:
FIVE_SECONDSTHIRTY_SECONDSFIVE_MINUTESTEN_MINUTESFIFTEEN_MINUTESTHIRTY_MINUTESHALF_HOURSIX_HOURSWEEK_STARTING_SUNDAYWEEK_STARTING_MONDAYWEEK_ENDING_SATURDAYWEEK_ENDING_SUNDAYQUARTER_YEAR
Troubleshooting
Common error messages you may encounter when connecting to or querying MySQL, along with their causes and solutions.
Compatible Databases
The following databases are compatible with the MySQL driver:
MariaDBMariaDB
MariaDB is a community-developed fork of MySQL, fully compatible with MySQL.
mysql://{username}:{password}@{host}:{port}/{database}
Amazon Aurora MySQLAmazon Aurora MySQL
Amazon Aurora MySQL is a fully managed, MySQL-compatible relational database with up to 5x the throughput of standard MySQL.
mysql+auroradataapi://{aws_access_id}:{aws_secret_access_key}@/{database_name}?aurora_cluster_arn={aurora_cluster_arn}&secret_arn={secret_arn}&region_name={region_name}
Parameters:
ParameterDescription
aws_access_idAWS Access Key ID
aws_secret_access_keyAWS Secret Access Key
database_nameDatabase name
aurora_cluster_arnAurora cluster ARN
secret_arnSecrets Manager ARN for credentials
region_nameAWS region (e.g., us-east-1)
Help improve this documentation by editing the engine spec:

TLS connections​

The SSL toggle (or ssl=1 in the connection URI) requires TLS rather than allowing an unencrypted fallback, and so does a URI or connect_args value of ssl_mode=REQUIRED (or stronger) without the toggle. With mysqlclient linked against Oracle libmysqlclient 5.7/8.x/9.x, this uses ssl_mode=REQUIRED. REQUIRED alone is not sufficient with MariaDB Connector/C, so with that or an unrecognized client library it becomes ssl_mode=VERIFY_CA: configure the appropriate ssl_ca for a private CA and use a certificate valid for the connection hostname. Explicit VERIFY_CA and VERIFY_IDENTITY are retained.

With mysql+mysqlconnector:// or mysql+pymysql://, the toggle enables certificate verification. A private CA must be supplied as ssl_ca; do not turn off verification to work around an untrusted certificate. PyMySQL 1.2 or newer is required for the toggle. Use individual SSL options rather than a nested ssl dictionary with PyMySQL. Conflicting options that disable TLS or verification are rejected.