Configuring a MySQL Data Source

From Explore Analytics: The Wiki
Revision as of 19:54, 4 March 2016 by Gadiyedwab (talk | contribs)
Jump to navigation Jump to search

Overview

Explore Analytics supports three ways of connecting to your MySQL database:

  1. Direct - if your database is accessible directly from the cloud, for example if it resides on Amazon AWS, then you can directly connect to it.
  2. PHP Script - if you're using PHP such as with Web hosting, you can connect to your MySQL database via a PHP script.
  3. Agent - if your database resides in your private network, the Explore Analytics Agent facilitates the communication between Explore Analytics and your database.

If the agent is required, please see the section Installing the Explore Analytics Agent for installation instructions.

The agent should be installed on a Windows computer that has access to the database. For example, you may install it on the computer that hosts the database.

If the PHP script is required, you need to install the PHP script before creating the data source. See instructions for installing the PHP script below.

Unless you're using a direct connection, the rest of this page assumes that you have the agent, or the PHP script, installed and running. You're now ready to setup the MySQL data source and create live reports that draw data directly from your database.

Creating the Data Source

To create the data source, go to the "Data" menu and select the option "Add a new data source", then select "MySQL". You will see the following dialog. Select "Direct", "PHP Script", or "Agent".

Add mysql data source.png

You will then see the following dialog. If you selected "PHP Script", skip to the "PHP Script" section below.

If you selected "Direct", then the agent drop-down selection will be absent. We show the dialog with some example inputs already populated. We then explain each entry.

Add mysql agent data source.png

Data Source Name

Give this data source a name that would identify it.

Description

Optional description. This is shown when you list data sources to help users choose the correct data source.

Agent Service Account

The choices for this field are typically pre-populated for you, and there's usually only one choice. This is the name of the Explore Analytics account through which the agent connects to Explore Analytics. You will need to make a selection here only if you have multiple agents that service different data sources.

MySQL Host

This is the host name (network computer name) of the computer on which the Oracle listener resides. If the agent is installed on the same computer as the database, then you can typically refer to the host as "localhost". If the database is on another computer, enter the name or IP address of that computer.

MySQL User

This is the name of the database user through which we connect to the database to access data. You can control access permissions by granting this user only the necessary (read) access to the tables.

MySQL Password

The password of the user entered in the previous field.

MySQL Database Name

The name of your MySQL database. A single MySQL server can hold multiple databases. This data source can only refer to one such database. If you need to access multiple databases, you'll need to create a data source for each.

PHP Script

Installing the PHP Script

The PHP script is a single PHP file that you download from the dialog (Create a PHP Script MySQL Data Source). You can see what this dialog looks like in the image below. The name of the file being downloaded is "dataconnector.php".

You'll need to edit the script to add your database configuration parameters and define the script user and password. This is defined at the top of the script and include the MySQL host, user, password, and database name.

The script also defines SCRIPT_USER and SCRIPT_PASSWORD. You'll need to define a user and password to authenticate the connection between Explore Analytics and your script. The script user can be anything, for example "explore_user". The password should be a strong password. You will enter this user name and password in the data source dialog below.

You can place the PHP script anywhere on your website where PHP scripts are normally placed. You'll specify the location in the dialog below.

Important: your website should support HTTPS (SSL) to secure the data connection between Explore Analytics and the PHP Script on your website.

Adding a PHP Script data source

To create the data source, go to the "Data" menu and select the option "Add a new data source", then select "MySQL". Select "PHP Script".

Add mysql php data source.png

Data Source Name

Give this data source a name that would identify it.

Description

Optional description. This is shown when you list data sources to help users choose the correct data source.

PHP Script URL

This is the URL that locates the PHP script that you installed on your website.

PHP Script User

The user defined in the PHP Script (e.g. "explore_user").

PHP Script Password

This is the password defined in the PHP script.

Getting Help

Don't hesitate to seek help. You can contact Explore Analytics Support.