To run JFrog Artifactory 7 on MySQL instead of the default embedded Derby database, you create a dedicated database and user, put the MySQL Connector/J JAR in Artifactory's bootstrap tomcat/lib folder, and add a shared.database block to var/etc/system.yaml. The steps below give you the basic sequence. The sections after them fix several details, add MySQL server settings, and show how to check that Artifactory is actually using MySQL.
Step 1 – Install and Configure mysql server
https://www.devopsschool.com/blog/how-to-install-mysql-server-and-client-on-ubuntu/
Code language: JavaScript (javascript)
Step 2 – Create a DB Username and Password and assign required access.
CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'artifactory'@'%' IDENTIFIED BY 'password';
GRANT ALL on artdb.* TO 'artifactory'@'%';
FLUSH PRIVILEGES;Code language: JavaScript (javascript)
Step 3 – Download mysql-connector-java-.jar driver
Download mysql driver from http://dev.mysql.com/downloads/connector/j/ to $JFROG_HOME/artifactory/var/bootstrap/artifactory/tomcat/lib
$ wget https://cdn.mysql.com/archives/mysql-connector-java-8.1/mysql-connector-j-8.1.0.zip
$ unzip mysql-connector-j-8.1.0.zip
$ cd mysql-connector-j-8.1.0
$ cp mysql-connector-j-8.1.0.jar /opt/artifactory-pro-7.23.3/var/bootstrap/artifactory/tomcat/lib
Code language: JavaScript (javascript)
Step 4 – Local system.yaml and add following entry
$ cd /opt/artifactory-pro-7.23.3
$ find . -name system.yaml
$ vi system.yaml
shared:
database:
type: mysql
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=false
username: artifactory
password: passwordCode language: JavaScript (javascript)
Before you start
- Artifactory 7.x installed but preferably not started yet. Configure the database before the first start so Artifactory creates its schema straight in MySQL.
- MySQL 8.x running and reachable from the Artifactory host on port 3306. Check JFrog's supported-database list for your exact Artifactory version.
- Java is not needed separately. Artifactory 7 ships its own JDK. You only supply the JDBC driver JAR.
- Know your
JFROG_HOME. For an archive (tar.gz) install it is the extracted folder, such as/opt/artifactory-pro-7.23.3. For RPM, DEB and Docker installs it is usually/opt/jfrog, so Artifactory's files are under/opt/jfrog/artifactory.
Note: JFrog recommends PostgreSQL for Artifactory, and other JFrog products such as Xray need PostgreSQL. MySQL works, but for a new production setup, check JFrog's current database recommendations before you commit to it.
Note: Pointing an existing Artifactory instance at a new database does not move any data. Artifactory starts with an empty database. To keep existing repositories, run a full system export first, switch the database, then import.
Creating the database and user safely
The SQL in Step 2 works. Here is why each part matters and where to tighten it. The utf8_bin collation matters most: Artifactory paths are case-sensitive, so the collation must be binary. A case-insensitive collation can cause duplicate-key errors when two artifact names differ only in letter case. On MySQL 8, utf8 is an alias for utf8mb3, so you will see a deprecation warning. Leave it unless JFrog's documentation for your version says otherwise. Moving to utf8mb4 can push indexed path columns past InnoDB's index length limit.
-- Run as a MySQL admin user
CREATE DATABASE artdb CHARACTER SET utf8 COLLATE utf8_bin;
-- Limit the account to the Artifactory host instead of '%'
-- Use 'localhost' if Artifactory runs on the same server
CREATE USER 'artifactory'@'10.0.1.25' IDENTIFIED BY 'Use-A-Long-Random-Password';
GRANT ALL PRIVILEGES ON artdb.* TO 'artifactory'@'10.0.1.25';
-- Check the result
SHOW GRANTS FOR 'artifactory'@'10.0.1.25';Code language: JavaScript (javascript)
Artifactory creates and upgrades its own tables, so it needs full rights on its own schema and nothing outside it. You don't need FLUSH PRIVILEGES after CREATE USER and GRANT. It only matters when someone edits the grant tables directly, but running it does no harm.
Recommended MySQL server settings
Artifactory writes large metadata rows and runs many short transactions, so MySQL's defaults are often too small. Add these to the [mysqld] section of my.cnf. On Ubuntu the file is usually /etc/mysql/mysql.conf.d/mysqld.cnf. Then restart MySQL.
[mysqld]
# Allow larger packets (the default can cause 'Packet for query is too large')
max_allowed_packet = 64M
# One tablespace file per table (default ON in MySQL 8, listed for clarity)
innodb_file_per_table = ON
# Size this to your RAM; on a dedicated DB server, about 50-70% of memory
innodb_buffer_pool_size = 2G
# Only needed if Artifactory is on a different host
bind-address = 0.0.0.0Code language: PHP (php)
sudo systemctl restart mysql
mysql -u root -p -e "SHOW VARIABLES LIKE 'max_allowed_packet';"Code language: JavaScript (javascript)
Installing the JDBC driver correctly
Artifactory 7 reads extra JARs from $JFROG_HOME/artifactory/var/bootstrap/artifactory/tomcat/lib and copies them into Tomcat at startup. Downloading only the JAR from Maven Central saves the unzip step. Since 8.0.31 the Maven artifact has been named mysql-connector-j.
export JFROG_HOME=/opt/artifactory-pro-7.23.3 # or /opt/jfrog for RPM/DEB installs
LIB=$JFROG_HOME/artifactory/var/bootstrap/artifactory/tomcat/lib
mkdir -p "$LIB"
wget -P "$LIB" https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.1.0/mysql-connector-j-8.1.0.jar
# Service installs run as the 'artifactory' user, which must be able to read the JAR
sudo chown artifactory:artifactory "$LIB"/mysql-connector-j-8.1.0.jar
ls -l "$LIB"Code language: PHP (php)
Note: Keep only one MySQL driver JAR in that folder. Two different Connector/J versions on the classpath can cause class-loading errors that are hard to trace. With Docker, put the JAR in the same path inside the mounted var volume on the host.
Corrected system.yaml configuration
Step 4 runs find and then opens system.yaml in the install root. That opens a new, empty file in the wrong place. The file Artifactory reads is $JFROG_HOME/artifactory/var/etc/system.yaml. Edit that file and keep the YAML indentation exactly as shown (two spaces, no tabs).
vi $JFROG_HOME/artifactory/var/etc/system.yamlCode language: PHP (php)
shared:
database:
type: mysql
driver: com.mysql.cj.jdbc.Driver
url: "jdbc:mysql://localhost:3306/artdb?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=false"
username: artifactory
password: "Use-A-Long-Random-Password"Code language: JavaScript (javascript)
driver: com.mysql.cj.jdbc.Driveris the class name for Connector/J 8.x. The oldcom.mysql.jdbc.Driveris deprecated and logs a warning at startup.- Putting the URL in quotes keeps YAML from misreading the
&and?characters. If you copy from a web page, make sure you have a literal&and not&. - If
shared:already exists in the file (for example withnode:settings), adddatabase:under the existingshared:. Don't create a secondshared:key. useSSL=falseis only acceptable when MySQL is on the same host or a trusted private network. For a remote database, usesslMode=REQUIREDinstead.
Artifactory encrypts the database password in system.yaml with its master key the first time it starts, so the plain-text value doesn't stay on disk.
Start Artifactory and verify the connection
- Test the credentials from the Artifactory host first:
mysql -u artifactory -p -h localhost artdb. If this fails, Artifactory will fail too. - Start or restart Artifactory. For archive installs run
$JFROG_HOME/artifactory/app/bin/artifactoryctl start. For service installs runsudo systemctl restart artifactory. - Watch the logs:
tail -f $JFROG_HOME/artifactory/var/log/console.log. Look for database errors in the first minute. Startup takes longer than usual the first time because Artifactory creates the schema. - Check the health endpoint:
curl http://localhost:8082/artifactory/api/system/pingshould returnOK. - Confirm the tables are in MySQL:
mysql -u artifactory -p artdb -e 'SHOW TABLES;'should list Artifactory tables such asnodesandbinaries.
Common errors and fixes
| Error in logs | Likely cause | Fix |
|---|---|---|
ClassNotFoundException: com.mysql.cj.jdbc.Driver | The JAR is missing from the bootstrap tomcat/lib folder or the service user can't read it | Copy the JAR to the correct path, fix ownership, then restart |
Loading class com.mysql.jdbc.Driver. This is deprecated | Old driver class name in system.yaml | Change driver to com.mysql.cj.jdbc.Driver |
Public Key Retrieval is not allowed | MySQL 8 caching_sha2_password authentication over a connection without SSL | Turn on SSL (sslMode=REQUIRED). On a trusted local network only, you can add allowPublicKeyRetrieval=true to the URL |
Access denied for user 'artifactory'@'...' | Wrong password, or the user's host part doesn't match the client address | Compare the host in the error with SELECT user, host FROM mysql.user; and create or grant the matching account |
Communications link failure | MySQL is down, bind-address is 127.0.0.1, or a firewall is blocking port 3306 | Check systemctl status mysql, bind-address and the firewall rules |
Packet for query is too large | max_allowed_packet is too small | Raise it in my.cnf and restart MySQL |
Security and operations best practices
- Never use
passwordas the database password, as the example above does. Generate a long random value and keep it in a secrets manager. - Limit the MySQL account to the Artifactory host's IP address, and block port 3306 from everywhere else.
- Back up the database and the filestore (
var/data/artifactory/filestore) at the same time. One without the other can't be restored to a consistent state. - Back up the master key in
var/etc/security/. Without it, Artifactory can't decrypt the encrypted values insystem.yaml. - Monitor MySQL connections, slow queries and InnoDB buffer usage. See Datadog Agent integration with MySQL for a ready-made setup.
Frequently asked questions
Where is system.yaml in Artifactory 7?
It is at $JFROG_HOME/artifactory/var/etc/system.yaml. For RPM, DEB and Docker installs that usually means /opt/jfrog/artifactory/var/etc/system.yaml. For an archive install it is inside the extracted folder.
Which MySQL driver class should Artifactory use?
With MySQL Connector/J 8.x, use com.mysql.cj.jdbc.Driver. The older com.mysql.jdbc.Driver still loads but is deprecated and logs a warning.
Will switching Artifactory from Derby to MySQL keep my repositories?
No. Artifactory starts with an empty schema in the new database. Run a full system export before you switch and import it afterwards.
Why does Artifactory need the utf8_bin collation?
Artifactory paths are case-sensitive. A binary collation makes MySQL treat names that differ only in letter case as different values, which avoids duplicate-key errors.
Is the database password stored in plain text in system.yaml?
Only until Artifactory first starts. On startup Artifactory encrypts the password with its master key, so back up that key along with your configuration.
Related tutorials
- More SQL & MySQL tutorials
- Datadog Tutorials: Datadog Agent integration with mysql databases?
- Top 50 Interview question and answers of MySQL
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals