Creating the Artifactory MySQL Database
Supported MySQL Versions
Artifactory supports MySQL v5.5, 5.6 and 5.7 with
InnoDB engine which is the default provided.
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.
Once you have verified that the script is correct, you need to run it to create the database and proceed with configuring the database.
If you are running MySQL database on a Docker container please use the following:
CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'artifactory'@'%' IDENTIFIED BY 'password';
GRANT ALL on artdb.* TO 'artifactory'@'%';
(Note: If the artifactory is failing to restart with the following error then run the above commands again in MySQL in Docker.
java.sql.SQLException: null, message from server: "Host 'xxxx' is not allowed to connect to this MySQL server")
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 "
We recommend providing Artifactory with full privileges on the database
Configuring Artifactory to use MySQL
Download the MySQL JDBC driver (available from the MySQL website) and copy the
.jarfile 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
Adjust the database connection details in the
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
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 Binary Provider 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:
/etc/my.cnf Absolute Path
/etc/my.cnf does not already exist it should be created under the absolute path and not under $JFROG_HOME
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
After tuning, you need to restart MySQL