Cloud customer?
Start for Free >
Upgrade in MyJFrog >
What's New in Cloud >


By using MySQL you can benefit from features in the MySQL infrastructure such as backup and restore.

For Artifactory to run with MySQL you must create a dedicated MySQL database instance and then configure Artifactory to use it as described in the following sections.

Before You Continue

Before proceeding with the steps below, please make sure you have read and followed the steps described in Configuring the Database.

Page Contents

Creating the Artifactory MySQL Database

Supported MySQL Versions

Artifactory supports MySQL 5.7 and 8.x with InnoDB engine, which is the default provided.

MySQL 5.5 and 5.6 are no longer supported as they have reached their EOL; users are requested to upgrade to the above versions of MySQL.

Artifactory provides a script that will execute the SQL commands you need to create your MySQL database.

The script can be found in $JFROG_HOME/artifactory/app/misc/db/createdb/createdb_mysql.sql and is displayed below.

You should review the script and modify it as needed to correspond to your specific environment.

createdb.sql Script
CREATE USER 'artifactory'@'%' IDENTIFIED BY 'password';
GRANT ALL on artdb.* TO 'artifactory'@'%';

Once you have verified that the script is correct, you need to run it to create the database and proceed with configuring the database.

Selecting a Case-Sensitive Collation

While MySQL Database Server is not case-sensitive by default, it is important to select a case-sensitive collation because Artifactory is case-sensitive. 

For example, in the createdb.sql script above COLLATE is set to "utf8_bin".

UTF8MB4 is not supported. We recommend that you adhered to the default "utf8_bin".

Artifactory privileges

We recommend providing Artifactory with full privileges on the database

Configuring Artifactory to use MySQL

  1. Download the MySQL JDBC driver (available from the  MySQL website).
    Select the option Platform Independent option in the Select Operating System drop-down list and click Download  next to the tar.gz or zip option, and unarchive it to get the jar file. 
    You can choose to register or log in, or click No thanks, just start my download to download the file.

  2. Copy the mysql-connector-j-<version>.jar file into $JFROG_HOME/artifactory/var/bootstrap/artifactory/tomcat/lib directory.


    Make sure your driver has the same permissions as the rest of the files in the $JFROG_HOME/artifactory/var directory.

  3. Adjust the database connection details in the system.yaml.configuration file.

    For example
        type: mysql
        driver: com.mysql.jdbc.Driver
        url: jdbc:mysql://<your db url, for example: localhost:3306>/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=false
        username: artifactory
        password: password

Storing BLOBs inside MySQL

The suggested (and recommended) configuration stores all artifact information in MySQL while the artifact binary data is stored on the file system (under $JFROG_HOME/artifactory/var/data/artifactory/filestore).

While it is not recommended, it is possible to store BLOBs inside MySQL provided that the typical BLOB size is relatively small. Storing large BLOBs in MySQL can cause memory issues because MySQL buffers BLOBs rather than streaming them (please refer to MySQL Bug #15089) and may result in OutOfMemory errors with large binaries depending on your JVM heap size.

To store BLOBs in MySQL, you will need to configure the Filestore with the Full-DB and Full-DB-Direct Binary Providers  and change max_allowed_packet to be higher than the maximum artifact size you intend to store in Artifactory.

Increasing MySQL Default Packet Size

Since some data files (builds, configurations etc.) are stored in MySQL, it is extremely important to increase the maximum allowed packet size used by MySQL to avoid errors related to large packets.  

(Please refer to MySQL documentation:  Packet Too Large).

It is recommended to change this in the /etc/my.cnf file as follows:

Modifying /etc/my.cnf
# The MySQL server
# The maximum size of the binary payload the server can handle

/etc/my.cnf Absolute Path

If /etc/my.cnf does not already exist it should be created under the absolute path and not under $JFROG_HOME

Restart required

After modifying the maximum allowed packed size you need to restart MySQL

You can also use the command line

You can also change the max_allowed_packet variable on the MySQL command line as in the following example:

SET GLOBAL max_allowed_packet = 134217728;

Note, however, that upon a restart, the value of the max_allowed_packet variable will be read from the /etc/my.cnf file and revert to the value in that file as described above.

Tuning MySQL for Artifactory

When using Artifactory with MySQL it is recommended to use the InnoDB engine with the following tuning parameters configured in the /etc/my.cnf file:

Tuning Parameters for MySQL
# The MySQL server
# By default innodb engine use one file for all databases and tables. We recommend changing this to one file per table.
# NOTE: This will take effect only if Artifactory tables are not created yet! Need to be set and MySQL restarted before starting Artifactory for the first time.
# Theses are tuning parameters that can be set to control and increase the memory buffer sizes.
# Theses control the innodb log files size and can be changed only when MySQL is down and MySQL will not start if there are some innodb log files left in the datadir.
# So, changing theses means removing the old innodb log files before start.

Restart required

After tuning, you need to restart MySQL

Copyright © 2022 JFrog Ltd.