MySQL and MariaDB - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

You can configure a MySQL or MariaDB database connection (with a MySQL JDBC driver) for use with Content Services.

  1. Install the MySQL database connector to allow the database to talk to the Content Services server.

    The connector is a JAR file, for example, mysql-connector-java-8.x.x.

    Check the Supported Platforms page for the correct driver version.

    1. Download the database connector from the MySQL site.
    2. Copy the JAR file into the /lib directory.

      For example, for Tomcat, copy the JAR file into the <TOMCAT_HOME>/lib directory.

  2. Create a database named alfresco.

    If you’re using MySQL and require the use of non-US-ASCII characters, you need to set the encoding for internationalization. This allows you to store content with accents in the repository. The database must be created with the UTF-8 character set and the utf8_bin collation. Although MySQL is a unicode database, and Unicode strings in Java, the JDBC driver might corrupt your non-English data. Ensure that you keep the ?useUnicode=yes&characterEncoding=UTF-8 parameters at the end of the JDBC URL.

    Note: You also must ensure that the MySQL database is set to use UTF-8 and InnoDB. See Optimize MySQL for more information.
  3. Increase the maximum connections setting in the MySQL configuration file.
    1. Locate the configuration file, for example:
      • Linux: /etc/my.cnf
      • Windows: c:\Users\All Users\MySQL\MySQL Server 5.x\my.ini
    2. In the mysqld section, add or edit the max_connections property:
       max_connections = 275
      						
    3. Restart the database.
  4. Create a user named alfresco.
  5. Set the new user’s password to alfresco.
  6. Navigate to the <ALFRESCO_HOME>/alf_data/ directory and empty the <contentstore> directory. This is because the contentstore must be consistent with the database. Step 2 created an empty database, and so the contentstore must also be empty.
  7. Open the <classpathRoot>/alfresco-global.properties.sample file.
  8. Edit the following line with an absolute path to point to the directory in which you want to store Content Services data. For example:
     dir.root=C:/Alfresco/alf_data
    					
  9. Uncomment the following properties:
     db.driver=com.mysql.jdbc.Driver
     db.url=jdbc:mysql://${db.host}:${db.port}/${db.name}?useUnicode=yes&characterEncoding=UTF-8
    
  10. Set the other database connection properties.
    db.name=alfresco
    db.username=alfresco
    db.password=alfresco
    db.host=localhost
    db.port=3306
    db.pool.max=275
    
    Note: Ensure that these database connection properties aren’t commented out.
  11. Copy the keystore directory from the alf_data directory in the old location to the alf_data directory in the new location (specified in step 7).
  12. (Optional) Enable case sensitivity.

    The default, and ideal, database setting for Content Services is to be case-insensitive. For example, the user name properties in the <configRoot>/classes/alfresco/repository.properties file are:

    # Are user names case sensitive?
    user.name.caseSensitive=false
    domain.name.caseSensitive=false
    domain.separator=
    

    If your preference is to set the database to be case-sensitive, add the following line to the alfresco-global.properties file:

    user.name.caseSensitive=true

  13. Save the file without the .sample extension.
  14. Restart the Content Services server.

    If you receive JDBC errors, ensure the location of the MySQL JDBC drivers are on the system path, or add them to the relevant lib directory of the application server.