How to Connect Your Self-Hosted MySQL Database to Indiequery
Connect your self-hosted MySQL database to Indiequery to query and explore data through a web interface. Whether you're running MySQL in Docker, on a VPS, or locally for development, you can connect in minutes with the right connection details.
What You Need
Before connecting your self-hosted MySQL database to Indiequery, you'll need:
- Your database host (IP address or domain name)
- Port number (default is
3306) - Database name
- Username with appropriate permissions
- Password for that user
- Network access configured (firewall rules, security groups, etc.)
If you're running MySQL locally or behind a firewall, you'll need to ensure Indiequery's IP address (91.98.141.61) can reach your database.
Connect from Docker
Most developers run MySQL in Docker for local development or production deployments. Here's how to find your connection details.
For Docker Compose:
If you're using Docker Compose, check your docker-compose.yml file for the MySQL service configuration:
services:
mysql:
image: mysql:8.0
environment:
MYSQL_DATABASE: myapp
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
MYSQL_ROOT_PASSWORD: rootpassword
ports:
- "3306:3306"
From this configuration:
- Host - Your server's public IP address or domain
- Port -
3306(the first port in3306:3306) - Database - Value of
MYSQL_DATABASE(e.g.,myapp) - Username - Value of
MYSQL_USER(e.g.,myuser) - Password - Value of
MYSQL_PASSWORD
For standalone Docker containers:
Run docker ps to find your MySQL container, then inspect it:
docker inspect <container_id> | grep -i mysql
Or check environment variables directly:
docker exec <container_id> env | grep MYSQL
Network access:
If your Docker MySQL is running on a VPS or cloud server, ensure port 3306 is exposed to the internet and your firewall allows incoming connections from 91.98.141.61. If running locally, Indiequery won't be able to connect directly - see the Local Development section below.
Connect from VPS or Bare Metal Server
If MySQL is installed directly on your VPS or server (not in Docker), you'll need to configure network access.
Find your connection details:
Check your MySQL configuration file (usually /etc/mysql/my.cnf or /etc/my.cnf) for the port:
grep "^port" /etc/mysql/my.cnf
Your database name, username, and password depend on how you set up MySQL. If you're not sure, connect locally and check:
mysql -u root -p -e "SHOW DATABASES;" # List databases
mysql -u root -p -e "SELECT user, host FROM mysql.user;" # List users
Configure network access:
By default, MySQL only accepts local connections. Edit my.cnf (usually /etc/mysql/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf) to bind to all interfaces:
bind-address = 0.0.0.0
Then grant access to Indiequery's IP for your database user:
-- Create a dedicated user for Indiequery
CREATE USER 'indiequery'@'91.98.141.61' IDENTIFIED BY 'secure_password';
-- Grant read access to specific database
GRANT SELECT ON your_database.* TO 'indiequery'@'91.98.141.61';
-- Apply changes
FLUSH PRIVILEGES;
Restart MySQL after making changes:
sudo systemctl restart mysql
Firewall rules:
Open port 3306 in your firewall for Indiequery's IP. For Ubuntu with ufw:
sudo ufw allow from 91.98.141.61 to any port 3306
For cloud providers (AWS, DigitalOcean, etc.), add an inbound rule in your security group allowing TCP port 3306 from 91.98.141.61.
Security note: Restricting access to specific IP addresses (like Indiequery's IP) is much safer than opening port 3306 to the entire internet.
Connect from Local Development
If MySQL is running on your local machine (laptop, desktop), Indiequery cannot connect directly because your database isn't exposed to the internet.
Two options:
Option 1: Deploy to a server - The simplest approach is to connect Indiequery to a staging or production database that's hosted on a VPS or cloud platform. Use your local database for development, and Indiequery for production/staging queries.
Option 2: SSH tunnel - Advanced users can set up an SSH tunnel through a server that acts as a bridge between Indiequery and your local database. This requires a public server with SSH access and some networking knowledge. This approach is not officially supported but may work if you need it.
For most developers, using Indiequery with production or staging databases (not local development databases) provides the best experience.
Add Connection in Indiequery
Once you've configured network access and found your connection details, connect to Indiequery:
- Go to app.indiequery.com and click Add Database Connection
- Host - Your server's IP address or domain name
- Port - Enter
3306(or your custom port) - Database - Your database name
- Username - Your MySQL username
- Password - Your MySQL password
- Require SSL - Check this if you've configured SSL (recommended for production)
- Name your connection (e.g., "Production Server")
- Click Add Connection
Indiequery tests the connection automatically. If successful, you're ready to query your self-hosted database.
SSL/TLS Encryption
For production databases, enable SSL to encrypt data in transit between Indiequery and your database. This prevents passwords and query results from being transmitted in plain text.
Enable SSL in MySQL:
Edit my.cnf:
[mysqld]
ssl-ca=/path/to/ca.pem
ssl-cert=/path/to/server-cert.pem
ssl-key=/path/to/server-key.pem
You can also enforce SSL for specific users:
ALTER USER 'indiequery'@'91.98.141.61' REQUIRE SSL;
Restart MySQL and check the "Require SSL" box when connecting in Indiequery.
For development or internal networks, SSL may be optional, but it's strongly recommended for any database exposed to the internet.
Common Connection Issues
"Connection timed out" or "Connection refused"
Verify your firewall allows connections from 91.98.141.61 on port 3306. Check that MySQL is binding to 0.0.0.0 (all interfaces) in my.cnf, not just localhost. Confirm your server's public IP or domain is correct.
"Authentication failed" or "Access denied for user"
Double-check your username and password. Verify the user has permission to connect from 91.98.141.61 (check with SELECT user, host FROM mysql.user;). MySQL usernames and passwords are case-sensitive.
"Unknown database"
Check available databases by connecting locally: mysql -u root -p -e "SHOW DATABASES;". Database names are case-sensitive.
"SSL required" or "SSL connection error"
If MySQL requires SSL but you didn't check "Require SSL" in Indiequery, the connection will fail. Either enable SSL in Indiequery or remove the SSL requirement for the user (not recommended for production).
"Host is not allowed to connect to this MySQL server"
Your user account is not authorized to connect from Indiequery's IP. Grant access with: GRANT SELECT ON database.* TO 'user'@'91.98.141.61';
"No route to host"
Your database server may not be reachable from Indiequery's IP. Verify your server's public IP is correct and that it's not behind a NAT or private network without proper port forwarding.
Network Security Best Practices
When exposing a self-hosted database to the internet:
- Restrict IP access - Only allow Indiequery's IP (
91.98.141.61) in your firewall and user grants - Use strong passwords - Generate long, random passwords for database users
- Enable SSL - Encrypt connections to prevent eavesdropping
- Create read-only users - Grant only SELECT privileges to the Indiequery user
- Regular backups - Always maintain backups before making configuration changes
Never expose MySQL to the entire internet (0.0.0.0/0 with '%' host) unless absolutely necessary and properly secured.
Next Steps
Once connected, you can:
- Browse tables and schemas in the schema explorer
- Run SQL queries with autocomplete
- Create charts and visualizations
- Save queries for reuse
- Build dashboards
- Export results to CSV, JSON, or Markdown
Navigate to the query editor and start exploring your self-hosted database.