mojoPortal supports 4 database systems; Microsoft SQL Server (MSSQL), MySQL, PostgreSQL (pgSQL), and SQLite

SQL Server

mojoPortal CMS supports Microsoft SQL Server 2008 and higher. Here's how to configure your installation to use SQL Server.

  1. Create a database and a SQL user, granting it DBO permission to the database.
  2. Configure the MSSQL Connection String in the user.config
    <add key="MSSQLConnectionString" value="server=DatabaseServerName;UID=DatabaseSQLUser;PWD=SQLUserPassword;database=DatabaseName" />

    Note: if using SQL Express, you typically get a "named" instance of SQL Server rather than a "default" instance. You can also have a named instance if you're using a standard version of SQL Server. If you have a named instance, you have to put the instance name along with the server name like this example where the instance name is SQLExpress:

    <add key="MSSQLConnectionString" value="server=DatabaseServerName\SQLExpress;UID=DatabaseSQLUser;PWD=SQLUserPassword;database=DatabaseName" />
  3. Navigate to www.yoursite.url/Setup/Default.aspx

MySQL

mojoPortal CMS supports MySQL 5.6.20 and newer. Here's how to configure your installation to use MySQL.

  1. Create a database and a SQL user, granting it full permission to the database (the GRANT option is not necessary).
  2. Configure the MySQL Connection String in the user.config
    <add key="MySqlConnectionString" value="Data Source=DatabaseServerName;Database=DatabaseName;User ID=DatabaseUsername;Password=DatabaseUserPassword;Charset=utf8;" />
  3. Navigate to www.yoursite.url/Setup/Default.aspx

Additional Info

PostgreSQL

mojoPortal CMS supports PostgreSQL 9.3 and higher. Here's how to configure your installation to use PostgreSQL.

  1. Create a login and then a database in PostgreSQL, setting the login as the owner of the database.
  2. Configure the PostgreSQL Connection String in the user.config
    <add key="PostgreSQLConnectionString" value="Server=DatabaseServerName;Port=5432;Encoding=unicode;User Id=DatabaseLogin;Password=LoginPassword;Database=DatabaseName;CommandTimeout=120;" />
  3. Navigate to www.yoursite.url/Setup/Default.aspx

SQLite

Since SQLite is a file based database, we ship a set of release files fully configured with a database file that is already loaded with default data. All you have to do is setup the web, make the Data folder writable and you're ready to go. You can edit the content of the site after you log in.

The instructions below are only here in case you want to create your own database instead of using the one included.

The preconfigured DB, mojo.db.config, is located at WebRoot/Data/sqlitedb/

In the same folder, you will also find the sqlite3.exe command line tool for Windows.

Open a command prompt and cd into this folder, or go to the folder in Explorer, click in the navigation bar and type "cmd" and hit enter, this will bring a command prompt up pointing to that folder.

To create a new database type sqlite3.exe yournewdbname.db.config next while at the SQLite prompt type .read initdb.config this will initialize the database.

CTRL+C will exit the SQLite prompt.

You'll need to put the full path to this file in the SqliteConnectionString in the Web.config then you should visit /Setup/Default.aspx to run the SQL scripts.

Note that the use of .config for the DB name is only to make the file protected by ASP.NET so it can't be requested using HTTP.

IIS 7 64 bit Issue

When trying to use SQLite under 64 bit Vista or Win 2008 server with IIS 7, you may get an error about an invalid file in relation to the sqlite3.dll because it is a 32-bit DLL. You can resolve this in IIS by going to the advanced properties of the application pool and setting "Allow 32-bit apps" to true.

Upgrading Notes

The mojoPortal deployment package for SQLite includes a database file located at /Data/sqlitedb/mojo.db.config

When you upgrade to a new version of mojoPortal after you have a site running with SQLite you do not want to overwrite your database file with the one included in the mojoPortal package. So you can either download your current database file and then upload it again after you upload the new files, or probably a better approach is to unzip the mojoPortal package on your local machine and remove the database file from the package before you upload the new files.

Last Modified by Joe Davis on Jan 25, 2018
Rate this Content 36 Votes