Extensions
Reading Data from MySQL
Named secrets can be used to manage connections to multiple MySQL database instances. Secrets can be given a name upon creation.  
```sql
CREATE SECRET mysql_secret_one (
TYPE MYSQL,
HOST '127.0.0.1',
PORT 0,
DATABASE mysql,
USER 'mysql',
PASSWORD ''
);
```  
The secret can then be explicitly referenced using the `SECRET` parameter in the `ATTACH`.  
```sql
ATTACH '' AS mysql_db_one (TYPE MYSQL, SECRET mysql_secret_one);
```  
#### SSL Connections {#docs:extensions:mysql::ssl-connections}  
The [`ssl` connection parameters](https://dev.mysql.com/doc/refman/8.4/en/using-encrypted-connections.html) can be used to make SSL connections. Below is a description of the supported parameters.  
| Setting     | Description                                                                                                                                      |
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| ssl_mode    | The security state to use for the connection to the server: `disabled, required, verify_ca, verify_identity or preferred` (default: `preferred`) |
| ssl_ca      | The path name of the Certificate Authority (CA) certificate file.                                                                                |
| ssl_capath  | The path name of the directory that contains trusted SSL CA certificate files.                                                                   |
| ssl_cert    | The path name of the client public key certificate file.                                                                                         |
| ssl_cipher  | The list of permissible ciphers for SSL encryption.                                                                                              |
| ssl_crl     | The path name of the file containing certificate revocation lists.                                                                               |
| ssl_crlpath | The path name of the directory that contains files containing certificate revocation lists.                                                      |
| ssl_key     | The path name of the client private key file.                                                                                                    |  
#### Reading MySQL Tables {#docs:extensions:mysql::reading-mysql-tables}  
The tables in the MySQL database can be read as if they were normal DuckDB tables, but the underlying data is read directly from MySQL at query time.  
```sql
SHOW ALL TABLES;
```  
<div class="narrow_table monospace_table"></div>  
|      name       |
|-----------------|
| signed_integers |  
```sql
SELECT * FROM signed_integers;
```  
<div class="narrow_table monospace_table"></div>  
|  t   |   s    |    m     |      i      |          b           |
|-----:|-------:|---------:|------------:|---------------------:|
| -128 | -32768 | -8388608 | -2147483648 | -9223372036854775808 |
| 127  | 32767  | 8388607  | 2147483647  | 9223372036854775807  |
| NULL | NULL   | NULL     | NULL        | NULL                 |  
It might be desirable to create a copy of the MySQL databases in DuckDB to prevent the system from re-reading the tables from MySQL continuously, particularly for large tables.  
Data can be copied over from MySQL to DuckDB using standard SQL, for example:  
```sql
CREATE TABLE duckdb_table AS FROM mysqlscanner.mysql_table;
```