Setting up the MySQL database for Alfresco

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up the MySQL database for Alfresco

resplin
Intermediate
0 2 10.2K

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Installation3.0Labs 3
This page describes how to download, install, and set up the MySQL database for use with Alfresco. For information on using other databases, see Using Alfresco with other databases than MySQL.


Download and install MySQL


Note: Alfresco requires MySQL 4.1 or higher.

To download and install MySQL:


  1. Browse to http://dev.mysql.com/downloads/mysql.
  2. Download the MySQL package.
  3. Navigate to your download location, and unzip the MySQL package.
  4. Double-click the setup.exe to start the MySQL Wizard.
  5. Use the Typical setup.
  6. Configure using the following options:
  • for non-English or non-West European languages, choose UTF8 Character set
  • install as a Windows service
  • include MySQL in path

Note:  Make sure that MySQL is configured using InnoDB engine, as this is needed to support transactions.  Most of the time this is already the default selection. 

Test MySQL is installed and running by opening a command prompt and enter:

mysql -u root -p

Installing the MySQL database connector


When installing Alfresco with MySQL, you must install the MySQL database connector. The database connector allows MySQL database to talk to the Alfresco server.

To install the MySQL database connector:


  1. Browse to the MySQL download site: http://dev.mysql.com/
  2. Download the MySQL Java Database Connector.
  3. Copy the JAR file into <container>/common/lib (for Tomcat).

Create a new database


To create the MySQL database for Alfresco to use:
(Version 3 will create the database for you)


  1. Open a command prompt.
  2. Type cd c:\alfresco\extras\databases\mysql, and press Enter.
  3. Type db_setup, and press Enter.
  4. At the prompt, enter the password that you use for MySQL, and press Enter. The database is prepared

Note: On Linux one can use: $ mysql -u root -p

If the setup is correct, a MySQL database is created with the following properties:


  • Database name is alfresco
  • Database user name is alfresco
  • Database password is alfresco

If the setup is incorrect, the following message may appear:

'mysql' is not recognized as an internal or external command

If you receive the previous error message, add the mysql command to the Windows Path variable, and try to create a MySQL database again.

To confirm that the database is created:


  1. Log into MySQL by typing mysql -u root -p.
  2. At the mysql prompt, type show databases;

A list of databases in MySQL displays, including one named alfresco.

NOTE: The database will contain NO TABLES. This is expected. The tables will be created when Alfresco is run for the first time.


Configuring the MySQL database


To replace the HSQL default database, you must modify values in both custom-repository.properties and custom-hibernate-dialect.properties, located within the extension folder.

To configure MySQL:


  1. Browse to the tomcat\shared\classes\alfresco\extension\ directory.
  2. Locate and open the following two files:
  • custom-hibernate-dialect.properties
  • custom-repository.properties


  1. For both files:
    • Use “#” to comment out any lines that refer to HSQL.
    • Remove the “#mysql#” from the beginning of each line for references to MySQL.

  1. In the custom-repository.properties, locate the following line: dir.root=...
  2. Edit the line to point to the directory in which you want to store Alfresco data. For example: dir.root=c:/alfresco/alf_data

Note: You can either save the file in its current location (the <extension> directory), or in another directory. If you save the file in the <extension> directory, no further action is needed because the file is already pointed to by the repository-properties bean in the <extension>/customrepository-context.xml file. If you save the file elsewhere, you must point to your customized file.

2 Comments
firdauss_noordi
Member II

Hi Richard Esplin,

I'm trying to configure alfresco with MySQL using above step. I'm stuck at configuring the MySQL database which I didn't find the custom-repository.properties and custom-hibernate-dialect.properties files to modify within alfresco installation folder.

My installer is alfresco-community-installer-201707-win-x64.

Please advise.

Thanks.

resplin
Intermediate

My name is attached as an artifact of the import process, so I don't have any special insight except to say that this document is very old and marked obsolete. The current documentation is here: Configuring the MySQL database | Alfresco Documentation 

If you still have trouble after referring to the current documentation, I recommend creating a question post in this space to see if a volunteer can help you out. See https://community.alfresco.com/community/about-this-community/blog/2016/09/07/things-you-should-incl...