2016-03-22 16:54:49 -04:00
---
layout: doc_page
---
# MySQL Metadata Store
Make sure to [include ](../../operations/including-extensions.html ) `mysql-metadata-storage` as an extension.
2018-10-20 21:18:58 -04:00
< div class = "note caution" >
The MySQL extension requires the MySQL Connector/J library which is not included in the Druid distribution.
Refer to the following section for instructions on how to install this library.
< / div >
## Installing the MySQL connector library
This extension uses Oracle's MySQL JDBC driver which is not included in the Druid distribution and must be
installed separately. There are a few ways to obtain this library:
- It can be downloaded from the MySQL site at: https://dev.mysql.com/downloads/connector/j/
- It can be fetched from Maven Central at: http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar
- It may be available through your package manager, e.g. as `libmysql-java` on APT for a Debian-based OS
This should fetch a JAR file named similar to 'mysql-connector-java-x.x.xx.jar'.
Copy or symlink this file to `extensions/mysql-metadata-storage` under the distribution root directory.
2016-03-22 16:54:49 -04:00
## Setting up MySQL
1. Install MySQL
Use your favorite package manager to install mysql, e.g.:
- on Ubuntu/Debian using apt `apt-get install mysql-server`
- on OS X, using [Homebrew ](http://brew.sh/ ) `brew install mysql`
Alternatively, download and follow installation instructions for MySQL
Community Server here:
[http://dev.mysql.com/downloads/mysql/ ](http://dev.mysql.com/downloads/mysql/ )
2. Create a druid database and user
Connect to MySQL from the machine where it is installed.
```bash
> mysql -u root
```
Paste the following snippet into the mysql prompt:
```sql
2018-03-13 04:16:10 -04:00
-- create a druid database, make sure to use utf8mb4 as encoding
CREATE DATABASE druid DEFAULT CHARACTER SET utf8mb4;
2016-03-22 16:54:49 -04:00
-- create a druid user, and grant it all permission on the database we just created
GRANT ALL ON druid.* TO 'druid'@'localhost' IDENTIFIED BY 'diurd';
```
3. Configure your Druid metadata storage extension:
Add the following parameters to your Druid configuration, replacing `<host>`
with the location (host name and port) of the database.
```properties
druid.extensions.loadList=["mysql-metadata-storage"]
druid.metadata.storage.type=mysql
druid.metadata.storage.connector.connectURI=jdbc:mysql://< host > /druid
druid.metadata.storage.connector.user=druid
2018-10-30 17:01:33 -04:00
druid.metadata.storage.connector.password=druid
2016-03-22 16:54:49 -04:00
```
Note: the metadata storage extension is not packaged within the main Druid tarball; it is
packaged in a separate tarball that can be downloaded from [here ](http://druid.io/downloads.html ).
2016-04-13 16:30:01 -04:00
You can also get it using [pull-deps ](../../operations/pull-deps.html ), or you can build
it from source code; see [Build from Source ](../build.html ).
2018-01-10 14:33:54 -05:00
## Encrypting MySQL connections
This extension provides support for encrypting MySQL connections. To get more information about encrypting MySQL connections using TLS/SSL in general, please refer to this [guide ](https://dev.mysql.com/doc/refman/5.7/en/using-encrypted-connections.html ).
## Configuration
|Property|Description|Default|Required|
|--------|-----------|-------|--------|
|`druid.metadata.mysql.ssl.useSSL`|Enable SSL|`false`|no|
|`druid.metadata.mysql.ssl.clientCertificateKeyStoreUrl`|The file path URL to the client certificate key store.|none|no|
|`druid.metadata.mysql.ssl.clientCertificateKeyStoreType`|The type of the key store where the client certificate is stored.|none|no|
2018-04-11 13:27:33 -04:00
|`druid.metadata.mysql.ssl.clientCertificateKeyStorePassword`|The [Password Provider ](../../operations/password-provider.html ) or String password for the client key store.|none|no|
2018-01-10 14:33:54 -05:00
|`druid.metadata.mysql.ssl.verifyServerCertificate`|Enables server certificate verification.|false|no|
|`druid.metadata.mysql.ssl.trustCertificateKeyStoreUrl`|The file path to the trusted root certificate key store.|Default trust store provided by MySQL|yes if `verifyServerCertificate` is set to true and a custom trust store is used|
|`druid.metadata.mysql.ssl.trustCertificateKeyStoreType`|The type of the key store where trusted root certificates are stored.|JKS|yes if `verifyServerCertificate` is set to true and keystore type is not JKS|
2018-04-11 13:27:33 -04:00
|`druid.metadata.mysql.ssl.trustCertificateKeyStorePassword`|The [Password Provider ](../../operations/password-provider.html ) or String password for the trust store.|none|yes if `verifyServerCertificate` is set to true and password is not null|
2018-01-10 14:33:54 -05:00
|`druid.metadata.mysql.ssl.enabledSSLCipherSuites`|Overrides the existing cipher suites with these cipher suites.|none|no|
|`druid.metadata.mysql.ssl.enabledTLSProtocols`|Overrides the TLS protocols with these protocols.|none|no|