VOOZH about

URL: https://www.cdata.com/kb/tech/mysql-powerbi-powerapps.rst

⇱ Connect to Real-Time MySQL Data in Power Apps Using Dataflows to Build Custom Applications


Connect to Real-Time MySQL Data in Power Apps Using Dataflows to Build Custom Applications

πŸ‘ Dibyendu Datta
Dibyendu Datta
Lead Technology Evangelist
Use CData Power BI Connector for MySQL and Dataflow to import and use MySQL data in Power Apps.

Power Apps is a suite of apps, services, and connectors that allows users to build custom applications with minimal or no coding. It empowers businesses to create tailored apps that solve specific business challenges, automate workflows, and integrate with various data sources, including Microsoft Dataverse, SQL Server, and third-party services.

Dataflows in Power Apps simplify the process of importing, transforming, and loading external data into Microsoft Dataverse or other storage systems. They allow users to connect to multiple data sources (like Salesforce, Excel, or SQL databases), clean or shape the data, and store it in Power Apps. When paired with the CData Power BI Connector for MySQL, it provides access to MySQL data to build custom applications and more

This article demonstrates how you can easily connect to MySQL using the CData Power BI Connector for MySQL and integrate your MySQL data through the Power Apps on-premises data gateway.

Configure a DSN to connect to MySQL data

Installing the Power BI Connector creates a DSN (data source name) called CData PBI MySQL Sys. This the name of the DSN that Power BI uses to request a connection to the data source. Configure the DSN by filling in the required connection properties.

You can use the Microsoft ODBC Data Source Administrator to create a new DSN or configure (and rename) an existing DSN: From the Start menu, enter "ODBC Data Sources." Ensure that you run the version of the ODBC Administrator that corresponds to the bitness of your Power BI Desktop installation (32-bit or 64-bit).

The CData Provider supports connecting to on-premises and cloud-hosted versions of MySQL such as Amazon RDS for MySQL, Google Cloud SQL for MySQL, Azure Database for MySQL, or Oracle MySQL HeatWave. The Server and Port properties must be set to a MySQL server. If IntegratedSecurity is set to false, then User and Password must be set to valid user credentials. Optionally, Database can be set to connect to a specific database. If not set, tables from all databases will be returned.

SSH Connectivity for MySQL

You can use SSH (Secure Shell) to authenticate with MySQL, whether the instance is hosted on-premises or in supported cloud environments. SSH authentication ensures that access is encrypted (as compared to direct network connections).

SSH Connections to MySQL in Password Auth Mode

To connect to MySQL via SSH in Password Auth mode, set the following connection properties:

  • User: MySQL User name
  • Password: MySQL Password
  • Database: MySQL database name
  • Server: MySQL Server name
  • Port: MySQL port number like 3306
  • UserSSH: "true"
  • SSHAuthMode: "Password"
  • SSHPort: SSH Port number
  • SSHServer: SSH Server name
  • SSHUser: SSH User name
  • SSHPassword: SSH Password

SSH Connections to MySQL in Public Key Auth Mode

To connect to MySQL via SSH in Password Auth mode, set the following connection properties:

  • User: MySQL User name
  • Password: MySQL Password
  • Database: MySQL database name
  • Server: MySQL Server name
  • Port: MySQL port number like 3306
  • UserSSH: "true"
  • SSHAuthMode: "Public_Key"
  • SSHPort: SSH Port number
  • SSHServer: SSH Server name
  • SSHUser: SSH User name
  • SSHClientCret: the path for the public key certificate file

Configure the on-premises data gateway to recognize the CData Power BI Connector for MySQL

In this section, we will configure the on-premises data gateway to detect the CData Power BI Connector for MySQL installed on your system. If you haven't installed the data gateway yet, you can download it from Microsoft's official website.

Set Up the Power BI Gateway

Follow the given process to configure the on-premise data gateway on your machine:

  1. Download and install the on-premises data gateway (recommended) option. πŸ‘ Install the On-Premise Data Gateway
  2. Sign into the gateway. πŸ‘ Sign into the gateway using your email-id
  3. Create a name for the new gateway and specify a recovery key. πŸ‘ Add a name and a recovery key to the gateway
  4. Open the new gateway, navigate to the Connector tab, and select the path C:\Program Files\CData\CData Power BI Connector for MySQL from the folder. Click on Apply. πŸ‘ The new gateway is now configured and ready to be used
    πŸ‘ Add the installation path to the CData Power BI Connector for MySQL

    NOTE: Select the folder where the gateway will search for the CData Power BI Connector.

  5. Once the CData Power BI Connector for MySQL is identified by the gateway, you're good to go. πŸ‘ The CData Power BI Connector for MySQL is identified by the gateway

Configure a dataflow connection in Power Apps

Once the on-premise data gateway is configured and a new gateway is created, follow these steps to create a dataflow that pulls in the MySQL data into Power Apps:

  1. Open Power Apps. πŸ‘ Open Power Apps
  2. Select Dataflows from the left panel on the Power Apps screen and click + New Dataflow. πŸ‘ Create a new dataflow
  3. Provide a name to the dataflow and click Create. πŸ‘ Add a name to the dataflow
  4. Select ODBC from the list of data sources. πŸ‘ Select ODBC
  5. On the ODBC Connection settings screen, use the connection details you set up earlier by entering DSN=Connection name (in this case, DSN=CData PBI MySQL Sys) in the connection string. The on-premise data gateway will display available gateways for connection - select the one you created. Due to the current specifications of Power Apps dataflows, authentication is required for ODBC connections. Choose Basic as the authentication type and enter the MySQL Username and Password. Click Next. πŸ‘ Configure the connection settings
  6. MySQL is now connected to Power Apps. Under Display options, expand CData under ODBC and MySQL under CData, and a list of all the MySQL tables will appear in the panel. When you select any one of these tables, a preview will appear, showing that the MySQL data is correctly referenced through the Power BI connector and on-premise data gateway. Next, click on Transform Data. πŸ‘ Click on Transform Data
  7. On the query editing screen, if no column conversion is needed, you can skip this step and proceed by clicking on Next. πŸ‘ Click on Next
  8. In the Choose destination settings screen, you can select how the selected table needs to be loaded by choosing options like Load to new table, Load to existing table, and Do not load. You can also change the Table display name and description as required. πŸ‘ Select how the table needs to be loaded
    πŸ‘ Choose the destination settings
  9. Finally, choose how you'd like to update your data: Refresh manually or Refresh automatically. In this case, we have set it to Refresh automatically. By scheduling it to update every 45 minutes, as shown below, data will be collected and registered every 45 minutes timeframe, ensuring the most up-to-date information is always available. (You can select any timeframe based on your convenience) πŸ‘ Choose among the two refresh settings
  10. Click on Publish. The dataflow will now be created, published, and displayed as a part of the dataflow list on the Dataflows screen. πŸ‘ Publish the dataflow

Get Started Today

At this point, you will have created a dataflow using live MySQL data and connected it to Power Apps. To learn more, explore the CData Power BI Connectors for Salesforce and download a free 30-day trial from the CData Power BI Connector for MySQL page.

Feel free to reach out to our Support Team with any questions.

Ready to get started?

Download a free trial of the MySQL Power BI Connector to get started:

 Download Now

Learn more:

πŸ‘ MySQL Icon
MySQL Power BI Connector

The fastest and easiest way to connect Power BI to MySQL data. Includes comprehensive high-performance data access, real-time integration, extensive metadata discovery, and robust SQL-92 support.