-
Notifications
You must be signed in to change notification settings - Fork 743
MySQL Database Setup
Assuming you already have a version of MySql installed. To get started quickly you can just setup the latest demo database.
Note: For quick development, it is recommended that you set your MySQL root password to 'mysql'. For doing that you need to fire the following command:
$ mysqladmin -u root -p 'oldpassword' password newpassword
Mifos X has support for hosting multiple tenants so we use two database schemas:
- mifosplatform-tenants: which is responsible for persisting the tenant information which is used when deciding what schema each incoming request in the platform should route to. It acts as a registry which contains the details of all the tenant databases, and their connection information, which is used by MifosX to connect to the appropriate tenant.
- mifostenant-default: All tenant specific schemas follow the pattern mifostenant-xxxx, out of the box the default schema is used to represent a demo
create database `mifosplatform-tenants`;
Then run the following gradle command to create tables and fill it with data for connecting to the tenant db. All gradle commands should be executed from mifosng-provider directory.
gradle migrateTenantListDB -PdbName=mifosplatform-tenants
create database `mifostenant-default`;
You don't need to run any SQL scripts for this database. When you start MifosX tomcat server, it will auto upgrade your DB. Still, in case you would like to populate the DB from command line, you can execute the following gradle command from inside the mifosng-provider directory:
gradle migrateTenantDB -PdbName=mifostenant-default
If you would like to see the state of your DB migrations, you can run the following command (which internally uses Flyway):
gradle showTenantDBInfo -PdbName=mifostenant-default
Note: By default, the files you clone from repository for setting up mysql and launching the application from the commad line assume a database user/password of root/mysql. Its likely that you have a different database user/password on your development machine so you should do the following:
(a) Update the schema settings associated with each entry in the mifosplatform-tenants
database for example:
Example of updating tenant with id 1 to use mifos/somepassword as username/password for database connections.
UPDATE mifosplatform-tenants.tenants SET schema_server = 'localhost', schema_server_port = '3306', schema_username = 'mifos', schema_password = 'somepassword' WHERE id=1;
(b) Also, to connect to the mifosplatform-tenants database, mifosX refers to this file: mifosx/mifosng-provider/src/test/resources/META-INF/context.xml. You might need to change the credentials here too.
see Launching platform server locally from the command line for actions required for launching platform locally from the command line.