31 lines
859 B
Plaintext
31 lines
859 B
Plaintext
---
|
|
title: MySQL
|
|
hide_title: true
|
|
sidebar_position: 25
|
|
version: 1
|
|
---
|
|
|
|
## MySQL
|
|
|
|
The recommended connector library for MySQL is [mysqlclient](https://pypi.org/project/mysqlclient/).
|
|
|
|
Here's the connection string:
|
|
|
|
```
|
|
mysql://{username}:{password}@{host}/{database}
|
|
```
|
|
|
|
Host:
|
|
|
|
- For Localhost: `localhost` or `127.0.0.1`
|
|
- Docker running on Linux: `172.18.0.1`
|
|
- For On Prem: IP address or Host name
|
|
- For Docker running in OSX: `docker.for.mac.host.internal`
|
|
Port: `3306` by default
|
|
|
|
One problem with `mysqlclient` is that it will fail to connect to newer MySQL databases using `caching_sha2_password` for authentication, since the plugin is not included in the client. In this case, you should use [mysql-connector-python](https://pypi.org/project/mysql-connector-python/) instead:
|
|
|
|
```
|
|
mysql+mysqlconnector://{username}:{password}@{host}/{database}
|
|
```
|