MySQL

Connecting Your MySQL Database to Sequel

Welcome to Sequel! This guide will help you connect your MySQL database to Sequel, allowing you to run SQL queries using natural language and visualize results with charts and graphs.

Prerequisites

Before you begin, ensure you have the following:

  • MySQL Database: Make sure your MySQL database is set up and running.
  • Database Credentials: You will need the following details:
    • Host URL or IP address
    • Database name
    • Username
    • Password
    • Port (default: 3306)
  • Sequel Account: You must have a Sequel account. If you haven’t signed up yet, you can create an account at Sequel.

Step 1: Navigate to Database Connections

  1. On the Sequel dashboard, locate the menu on the left-hand side.
  2. Click on Database Connections to open the database management page.

Step 2: Add a New Connection

  1. In the Databases section, click the New Connection button.
  2. From the list of available database types, select MySQL.

Step 3: Enter Connection Details

You will now need to enter the required information to connect your MySQL database:

  1. Display Name: Give your connection a meaningful name (e.g., "Production Database" or "Analytics DB").
  2. Host: Enter the hostname/URL or IP address of your MySQL database server.
  3. Port: The default port for MySQL is 3306. If your database uses a different port, specify that here.
  4. Database Name: Enter the name of the MySQL database you want to connect to.
  5. Username: Provide the MySQL username with access to the database.
  6. Password: Enter the password for the MySQL user.

Optionally, you may also configure SSL settings or provide additional connection parameters if required by your MySQL setup.

Example of a MySQL Connection String

If you want to connect via a connection string, the format typically looks like this:

mysql://username:password@hostname:3306/databasename

Example:

mysql://root:password@192.168.1.100:3306/mydatabase
  • Username: root
  • Password: password
  • Host: 192.168.1.100 (Replace with your server's IP address or hostname)
  • Port: 3306 (default port)
  • Database Name: mydatabase

How to Get the Connection Parameters

  1. Host: This is typically the IP address or domain name of the server where MySQL is hosted. You can get this from your server admin or hosting provider. For local databases, you can use localhost or 127.0.0.1.

  2. Port: The default MySQL port is 3306. If your MySQL server is set up with a non-default port, you can find it in your MySQL configuration file (my.cnf or my.ini).

  3. Database Name: This is the specific database you want to connect to. You can find the list of available databases by running the following command in the MySQL CLI:

    SHOW DATABASES;
    
  4. Username: This is the MySQL user that has permissions to access the specified database. You can manage users using the MySQL CLI:

    SELECT user FROM mysql.user;
    
  5. Password: The password associated with the MySQL user. Ensure that the user has appropriate privileges for the database you want to connect to.

Step 4: Test and Save the Connection

Click on the test and save connection button to validate the connection details and save the connection. After a successful test, Sequel will open the explorer view for your connected database. You can now ask your database questions or execute SQL queries.

Step 5: Query Your Database

Now that your MySQL database is connected, you can start querying it using natural language:

  1. Return to the Sequel dashboard.
  2. In the query input box, type a question or request, such as “Show me the list of users added last month” or “What is the average order value?”.
  3. Sequel will convert your request into an SQL query, execute it against your MySQL database, and display the results.

Step 6: Visualize Data with Charts and Graphs

Sequel allows you to create visualizations by simply asking it to visualize the data as a bar chart, line chart, or pie chart.

For example:

  1. Show me the user growth in the last 30 days in a line chart.
  2. Show me a bar graph of my top-selling products.
  3. Show me a pie chart of the top 10 organizations with the most users.

Troubleshooting

If you encounter any issues during the connection process:

  1. Connection Errors: Double-check your credentials and ensure your MySQL database is reachable from the internet (or from within your local network if using a private instance).
  2. Firewall/Network Issues: Ensure that your MySQL database server allows connections from Sequel's IP addresses or the IP address of your local machine (if using Sequel on-prem).
  3. SSL Configuration: If your MySQL server requires SSL, make sure the proper SSL certificates and settings are provided during connection setup.

Conclusion

That’s it! You’ve successfully connected your MySQL database to Sequel. Now you can leverage Sequel’s powerful natural language processing to query your database and generate insightful visualizations.

If you have any further questions or need additional help, feel free to reach out to our support team or consult the Sequel documentation.

Happy querying!


Additional Resources