18. Connecting Your Local Database

This guide will help you connect your local database to AI2sql using ngrok. By following these steps, you can securely expose your local database to AI2sql, enabling seamless integration.

Step 1: Install ngrok

1.1 Download ngrok

1.2 Install ngrok

  • Extract the downloaded file to a directory accessible from the command line.

1.3 Create an ngrok Account

1.4 Authenticate ngrok

  • Copy your auth token from the ngrok dashboard.

  • Open your terminal and run the following command, replacing <your_auth_token> with the token you copied:

    ngrok authtoken <your_auth_token>

Step 2: Start ngrok Tunnel

2.1 Start the Tunnel

  • For a local MySQL database running on port 3306, run the following command:

    ngrok tcp 3306

2.2 Copy the Forwarding URL

  • After starting the tunnel, ngrok will provide a forwarding URL in the format tcp://0.tcp.ngrok.io:12345.

  • Copy this URL; you will need it to connect AI2sql to your local database.

Step 3: Connect ngrok URL to AI2sql

3.1 Open AI2sql

  • Log in to your AI2sql account.

3.2 Navigate to Database Connectors

  • Go to the database connectors section within AI2sql.

3.3 Add a New Database Connection

  • Click on "Add New Connection" or a similar option.

3.4 Enter Connection Details

  • Database URL: Paste the ngrok forwarding URL you copied earlier (e.g., tcp://0.tcp.ngrok.io:12345).

  • Username: Enter your local database username.

  • Password: Enter your local database password.

  • Database Name: Enter the name of your local database.

3.5 Save the Connection

  • Save the new database connection settings.

3.6 Test the Connection

  • Use the test connection feature (if available) to ensure everything is set up correctly.

Step 4: Using the Database in AI2sql

  • You can now use your local database in AI2sql as if it were a cloud-based database.

  • Enjoy the features and benefits of AI2sql with your local data securely connected.

Troubleshooting

Common Issues

  • Tunnel Not Working: Ensure ngrok is running and you have copied the correct forwarding URL.

  • Authentication Failed: Double-check your database username and password.

  • Connection Timeout: Verify that your local database is running and accessible.

Getting Help

  • Visit the ngrok documentation for more detailed information.

  • Check the AI2sql help center for additional support.

Last updated