Export data through cli


I’m running a docker integrated keycloak instance with MariaDB storage backend.

As I would like to be able to rebuild my config from scratch, I’m trying to setup an automated keycloak full data export through command line.

I use command from documentation page Export and Import

docker exec -it keycloak /opt/jboss/keycloak/bin/standalone.sh -Djboss.socket.binding.port-offset=100 -Dkeycloak.migration.action=export -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.realmName=clusters -Dkeycloak.migration.usersExportStrategy=REALM_FILE -Dkeycloak.migration.file=/opt/jboss/keycloak/standalone/data/backup/dump.json

The issue is that it fail, due to the error message below :

Caused by: java.sql.SQLException: Access denied for user ‘admin’@‘’ (using password: YES)
Current charset is US-ASCII. If password has been set using other charset, consider using option ‘passwordCharacterEncoding’

As my password has been set using latin1 charset, I would like to set passwordCharacterEncoding

Question : Is there any option to set passwordCharacterEncoding through cli ?


It uses the connection configured in Keycloak when doing the export, so I would assume it’s just about setting the property in the JNDI url.

Thanks for your answer.

But starting with the fact that my keycloak is working fine using the current JNDI, I don’t understand why I would have to set a charset for the export to be done. I think that the issue is somewhere else :persevere: