# Get Data from the Cloud Voice Database

Cloud Voice can expose its underlying system database so that reporting tools and other third-party software can read records such as call detail records (CDRs) directly. This page walks you through granting database access from the PBX (Private Branch Exchange) web portal and then connecting to it with the Navicat for MySQL client.

The work happens in two stages: first you enable and secure access on the PBX, then you build a connection from your MySQL client.

## Grant access to the PBX database

1. Sign in to the PBX web portal and navigate to **Integrations > Database Grant**.
2. Enable the **Database Grant** switch, then set the credentials that external software will use to connect.

   ![Enabling database access and entering the connection user name and password](/images/pbx/enable-database-grant-to-fillin-userpassword-ce.png)

   - **User Name**: Keep the automatically generated user name, or replace it with one of your own.
   - **Password**: Keep the automatically generated password, or replace it with one of your own.

   :::tip
   The automatically generated user name and password are random and hard to guess. Keep them unless you have a specific reason to change them, and store them somewhere safe: you will need them again when you build the client connection.
   :::
3. Under **Permitted IP**, define which addresses are allowed to reach the database.

   :::caution
   Only add IP addresses you trust. Any host inside a permitted range can attempt to reach the database with the credentials above, so keep the list as narrow as possible (ideally a single address) and avoid opening it to networks you do not control. A `255.255.255.0` mask permits an entire subnet, not just one machine.
   :::

   ![Adding a permitted IP address and subnet mask for database access](/images/pbx/database-grant-permitted-ip-ce.png)

   1. Click **Add**.
   2. Enter the permitted IP address and subnet mask. For example, entering the public IP address of your current network (`110.80.36.162`) with a subnet mask of `255.255.255.0` lets every host on that network connect.

      :::note
      MySQL restricts the subnet masks you can use here to two values: `255.255.255.255` (a single host) and `255.255.255.0` (an entire subnet).
      :::
4. Click **Save**, then **Apply**. The PBX now displays the **Database Address** and **Port**; these values are fixed and cannot be edited.

   
   ![Cloud Voice, database access enabled, showing the read-only database address and port](/images/pbx/enable-database-grant-ce.png)

## Connect with Navicat for MySQL

1. Open [Navicat for MySQL](https://www.navicat.com/en/products/navicat-for-mysql) on your computer.
2. Click **Connection** and choose **MySQL**.

   ![Starting a new MySQL connection in Navicat](/images/pbx/navicat-connection.png)
3. In the dialog that appears, fill in the connection details:

   
   ![Cloud Voice, Navicat connection settings with host, port, and credentials](/images/pbx/navicat-general-ce.png)

   - **Connection Name**: Any label that helps you recognize this connection.
   - **Host**: The database address shown on the PBX.
   - **Port**: `15023`.
   - **User Name**: The user name you configured on the PBX (for example, `mQRpgU7N`).
   - **Password**: The password you configured on the PBX (for example, `Ydugei296kd`).
4. Click **Save**.
5. Double-click the connection to open it, then select a table to view its data.

   ![Browsing the CDR table after opening the database connection](/images/pbx/check-cdr-table.png)

   :::note
   For a breakdown of each table and its fields, see [Tables in the PBX Database](/pbx/administrator-guide/cdr-table-in-the-pbx-database/).
   :::
