All Collections
Connecting your Database or Data Warehouse
How to connect Locale with MySQL database
How to connect Locale with MySQL database

Everything you need to know about connecting your command centre with you MySQL databases

Rishabh Jain avatar
Written by Rishabh Jain
Updated over a week ago

MySQL is a relational database management system (RDBMS) developed by Oracle that is based on structured query language (SQL).

Prerequisites

  • Your MySQL Server is running

  • Your MySQL database host’s IP/DNS and port are available. If you do not have these details, you can obtain them from your database administrator

  • The necessary privileges are granted to the database for your database use.

Steps

  • Step 1: Whitelist Locale’s IP Addresses

  • Step 2: Create a User and Grant Privileges

  • Step 3: Retrieve the Hostname and Port Number (Optional)

  • Step 4: Configure MySQL as a Data Connection on Locale

Creating a Database User and Granting Privileges

1. Create a database user

If you want to use an existing user with Locale, you can skip these steps, However, It is recommended to create a new user for the locale with only the necessary permissions.

Perform the following steps to create the login and database users in your MySQL database:

1. Log in to your MySQL instance using root or any other superuser.

mysql -u root -p

2. Enter the following command to create a user with caching_sha2_password plugin, so that locale can authenticate using a password.

CREATE USER 'localeuser'@'host' IDENTIFIED BY 'password';

2. Grant privileges to the user

Perform the following steps to grant the required privileges to the database user, to read the database objects and schema:


1. Log in to your MySQL Server instance using an SQL client tool as the login user created in this section.

2. Use the following SQL queries to grant privileges to the database user:

GRANT SELECT ON database.table TO 'localeuser'@'host';


Alternatively, you can use this query to grant SELECT privilege on all databases and tables

GRANT SELECT *.* TO 'localeuser'@'host';


Configure MySQL Server as a Data Connection on Locale

Perform the following steps to configure MySQL as a data connection:

1. Log in to your locale command center and click on the Data Connections option under the ⚙️ Org Settings, on the left-hand side menu

2. Select MySQL Database from the available options

Integrating your locale command centre with your existing MySQL database

3. Enter your database details.

  • Name the data source → A unique name to identify the data source. You could have multiple MySQL databases connecting to Locale so you can use this name to differentiate between each of them within Locale’s platform uniquely.

  • Host Address → The Domain address/IP Address of your database.

  • Port → The port on which the database accepts connections (The default value for MySQL is 3306).

  • Database Name → Enter the database name to which the connection needs to be made. You can create new connections for different databases.

  • Username → Database Username.

  • Password → Password for the mentioned database user.

  • Use SSL → Check this option if you want the connection to be encrypted over SSL.

4. Click on Test Connection and wait for the authentication to complete.

5. Once the connection is tested, you can click on Save Connection and start setting up your alerts.

Note : Locale will cancel queries that run for more than 90 seconds. This is to protect your database from running rogue queries and also to prevent a backlog of alerts in the Locale system. If you have a use case where this needs to be increased then please get in touch with our Support.

Happy Alerting 🙌🏻


Blazing-fast operations minus all the constant firefighting👨‍🚒

Learn how to set up a control tower for your operations in under 15 minutes ️‍🔥

...with Locale for modern ops teams


Did this answer your question?