[keycloak-user] adding mysql or mariadb backend

Vlasta Ramik vramik at redhat.com
Thu Mar 21 08:03:09 EDT 2019


Hello,

you can take a look at 
https://github.com/keycloak/keycloak/blob/cf35a4648bcb93aaf1ac63918ee5c4b0f422d7d5/testsuite/integration-arquillian/servers/auth-server/jboss/common/jboss-cli/configure-server-jpa.cli 
for inspiration.

V.

On 3/19/19 9:43 PM, Andrew Meyer wrote:
> Hello,If I am adding a mariadb or mysql backend to keycloak v4.8.3 or 5.0.0 what is the correct syntax from the jboss-cli.sh tool?   This is what I have in my notes.
> Open the Jboss CLI and add the MySQL driver (you don't have to connect with the Jboss websocket).
> $ ./bin/jboss-cli.sh Is this the correct mysql connector version for MariaDB 10.1.x?MySQL/MariaDBjboss-cli$ module add --name=com.mysql  --dependencies=javax.api,javax.transaction.api --resources=/root/mysql-connector-java-5.1.47.jar
>
> Add the Database driver to the configuration.
> MySQL/MariaDB# sudo su -
> Is this the correct syntax for the driver?  Should it be com.mysql or org.mysql??
> $ sudo -u keycloak ./bin/jboss-cli.sh 'embed-server,/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-class-name=com.mysql.jdbc.Driver)'
>
> Remove the h2 KeycloakDS data source and add the MySQL KeycloakDS data source. (Don't delete the test database and change YOURPASS to something random)
> MySQL/MariaDB
> # sudo su -$ sudo -u keycloak ./bin/jboss-cli.sh 'embed-server,/subsystem=datasources/data-source=KeycloakDS:remove'
> $ sudo -u keycloak ./bin/jboss-cli.sh 'embed-server,/subsystem=datasources/data-source=asmDS:add(driver-name=com.mysql,enabled=true,use-java-context=true,connection-url="jdbc:mysql://10.150.10.20:3306/keycloak?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=America/Chicago&characterEncoding=UTF-8",jndi-name="java:/jboss/datasources/KeycloakDS",user-name=keycloak,password="ChangeMe",valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker,validate-on-match=true,exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker)'
> $ sudo -u keycloak ./bin/jboss-cli.sh 'embed-server,/subsystem=datasources/data-source=asmDS:test-connection-in-pool'
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list