How to Share a Local Database with Your Team Without Deploying It
Share your local PostgreSQL, MySQL, MongoDB, or MSSQL database with teammates using a Localtonet TCP tunnel. Ready in two minutes, no staging environment needed.
In this article 12 sections
Give an authorized teammate temporary access to the database running on your machine
A short debugging or review session does not always justify provisioning a staging database. With a Localtonet TCP tunnel, an authorized teammate connects to a public host and port that forwards to a database reachable from the Localtonet client device. This guide covers PostgreSQL, MySQL or MariaDB, MongoDB, and Microsoft SQL Server. It walks through the documented tunnel setup, database settings that matter behind a tunnel, native TLS, IP Restriction, keeping a stable port, error-specific troubleshooting, and session cleanup.
📋 What's in this guide
When sharing a local database is appropriate

A temporary tunnel is useful when a teammate needs to reproduce a bug against your current development state, inspect a migration result, review generated test records, or join a controlled troubleshooting session. The teammate reaches the same database process you are using, so you do not need to copy that state into a newly deployed environment first.
Treat this workflow as temporary, supervised access. Your machine, the database process, the Localtonet client, and the tunnel must stay available throughout the session. If the client disconnects or the tunnel stops, the public address no longer reaches the local service. On the Free plan, a TCP tunnel also stops after 30 minutes and must be started again, which suits short sessions but not an always-on dependency.
A deployed development or staging database is usually the better choice when access must be persistent, several teams need an independently managed environment, automated systems depend on it, or destructive testing must be isolated from a developer's active workspace. A database export can be safer when the recipient needs a fixed snapshot rather than a live connection.
While the tunnel is running, its public host and port can receive connection attempts from the internet. A hard-to-guess address is not access control. Use a dedicated least-privilege database account with a password, database-native TLS, IP Restriction on the tunnel (this needs Balance), anonymized test data, and prompt shutdown and credential revocation.
How a Localtonet database tunnel works

Network database clients connect over TCP, but local tools do not always use TCP. A PostgreSQL command run without a host can use a Unix-domain socket, and other local tools may pick a different transport automatically. A Localtonet TCP tunnel needs a real TCP listener that the Localtonet client device can reach.
The traffic path for this tutorial is:
- Your teammate's database client connects to the public Localtonet host name and port.
- The relay associates that connection with the running TCP tunnel.
- The Localtonet client keeps an outbound connection from your device to the relay.
- The client opens a connection to the configured local target, such as
127.0.0.1:5432, and forwards the traffic. - The database performs its normal authentication, authorization, transaction, and TLS processing.
Localtonet does not replace database authentication and does not grant permissions the database has not assigned. The tunnel changes how the teammate reaches the listener. The database still decides whether a login is accepted and what that login may do.
The database sees the Localtonet client, not the visitor
Because the Localtonet client opens the final connection, every tunneled connection reaches the database from the client's address. That is 127.0.0.1 or localhost when the client runs on the database machine, or the client device's LAN address when it runs elsewhere in the network. This has three practical consequences:
- Database-side address rules cannot tell visitors apart. A
pg_hba.confADDRESS column, a MySQL account host, SQL Server firewall rules, or logon triggers that filter by client address all see the same source for every visitor. - Any rule that trusts local connections without a password, such as a PostgreSQL
trustrule for127.0.0.1/32, lets anyone who reaches the tunnel in. - Database logs record the Localtonet client as the source. To see visitor IP addresses, use the tunnel's Request Log, and to filter visitors, use the tunnel's IP Restriction.
A target of 127.0.0.1 refers to the device running the Localtonet client. If the database runs on another LAN host, enter that machine's address in the tunnel. If it runs in a container, publish the container port to the host before pointing the tunnel at it.
This outbound model avoids inbound router port forwarding, but it must still comply with your employer's network, data-handling, and security policies. Do not use a tunnel to evade organizational controls. Some managed networks block outbound traffic or prohibit public exposure, so obtain authorization first.
Prerequisites and decisions to make first
Prepare the database and the sharing policy before creating a public endpoint. That way a tunnel is never started while authentication, permissions, or test data are still unsafe.
postgres, root, sa, or a MongoDB administrator.
Identify the actual TCP port
Common default ports are 5432 for PostgreSQL, 3306 for MySQL and MariaDB, 27017 for MongoDB, and 1433 for SQL Server. These are defaults, not guarantees. Configuration files, containers, named SQL Server instances, and multiple installations can use different ports.
| Database | Default port and where to check it | Important qualification |
|---|---|---|
| PostgreSQL | 5432, or port in postgresql.conf |
A local client may use a Unix socket unless you explicitly test a TCP host. A trust rule for local addresses must be replaced. |
| MySQL or MariaDB | 3306, or the port in your MySQL configuration |
Accounts are user plus host, and through the tunnel the host is the Localtonet client. |
| MongoDB | 27017, or net.port in mongod.conf |
A self-managed server accepts every connection without credentials until access control is enabled. |
| Microsoft SQL Server | 1433, or the TCP Port set under IPAll |
TCP/IP is off by default on Express and Developer editions, and named instances use a dynamic port until you set a fixed one. |
Prepare safe data and credentials
Prefer generated, seeded, or anonymized records. Remove or transform personal data, access tokens, API credentials, payment information, private documents, and production secrets.
Decide whether the teammate needs read-only access, data modification, migration privileges, or schema changes. Read-only is the safer default, and schema-destructive permissions should normally stay unavailable during a live session.
Verify TCP connectivity before exposing anything
Test from the device that will run the Localtonet client. This separates database configuration problems from tunnel problems. Use 127.0.0.1 explicitly so the client cannot fall back to a Unix socket or another transport. Each test should ask for a password. If it does not, fix authentication before you go further.
Every value below is a placeholder. Replace LOCAL_PORT, DATABASE_NAME, and TEAM_USERNAME with your actual values, and let the client prompt for the password.
PostgreSQL local test
psql -h 127.0.0.1 -p LOCAL_PORT -U TEAM_USERNAME -d DATABASE_NAME
psql should ask for the password. After connecting, run a harmless query:
SELECT 1;
MySQL or MariaDB local test
Uppercase -P is the port. Lowercase -p makes the client prompt for the password.
mysql -h 127.0.0.1 -P LOCAL_PORT -u TEAM_USERNAME -p DATABASE_NAME
SELECT 1;
MongoDB local test
Users are usually created in the admin database, so authenticate against it:
mongosh "mongodb://127.0.0.1:LOCAL_PORT/DATABASE_NAME" --username TEAM_USERNAME --authenticationDatabase admin
db.runCommand({ ping: 1 })
Also try connecting without --username and reading a collection. With access control enabled, the read must fail.
SQL Server local test
SQL Server writes the port after a comma. sqlcmd prompts for the password when you leave out -P.
sqlcmd -S tcp:127.0.0.1,LOCAL_PORT -U TEAM_USERNAME -d DATABASE_NAME
SELECT 1;
GO
Password arguments can be retained in shell history, process listings, logs, screenshots, clipboard managers, and support transcripts. Use an interactive prompt, an approved secret manager, or your client's protected credential storage. Never commit a connection string containing a password to source control.
Do not start the tunnel until the intended account can connect locally over TCP with a password and a disallowed account or operation is rejected. A local authentication failure will not be repaired by adding a relay.
Configure the Localtonet TCP tunnel

The same workflow applies to all four databases. Before you begin, you need a Localtonet account and the Localtonet client running on the device and connected with your AuthToken, as covered in our Quick start. Then follow these documented steps using the port you verified in the previous section. Database-specific versions are in our documentation for PostgreSQL, MySQL, MongoDB, and Microsoft SQL Server.
Open the TCP - UDP page
In the dashboard, open My Tunnels › TCP - UDP and expand Create TCP - UDP Tunnel.
Fill in the form
Set Protocol to TCP. Choose the Device token that the Localtonet client on the database device uses. Pick a Server region close to the device for lower latency. Enter the Local IP address, which is 127.0.0.1 when the database runs on the same device as the client, otherwise the LAN machine's address. Enter the Local port of the database. Leave URL type on Random subdomain. Custom subdomain lets you choose the name and needs Balance.
Select Create tunnel
Creating the tunnel saves the configuration. It does not make the database reachable yet.
Start the tunnel and copy the address
The tunnel appears under Your tunnels. Select Start. The URL column shows the public address as host:port, and the Server Port column shows the port on its own. A healthy tunnel shows ON in the Connection column.
For quick reference, the Local port values per database are:
| Database | Local port to enter | How the teammate writes the address |
|---|---|---|
| PostgreSQL | 5432 or the postgresql.conf port |
-h HOST -p PORT, or host and port fields |
| MySQL or MariaDB | 3306 or your configured port |
-h HOST -P PORT, or host and port fields |
| MongoDB | 27017 or net.port |
mongodb://HOST:PORT/DB |
| SQL Server | 1433 or the fixed TCP Port you set |
tcp:HOST,PORT with a comma |
The Local port belongs to the database on your device. The Server Port is the public port your teammate enters, and it is assigned when the tunnel starts. The two do not need to match. Always copy the current host and Server Port from the running tunnel, and do not leave a GUI client on its default port unless you set the Server Port to that value.
Keep the same address across restarts
A tunnel address has two parts that behave differently. The host name stays with the tunnel. The port is assigned by the server when the tunnel starts. For a one-off session that is fine, but an application connection string or a saved client profile breaks when the port changes.
5432, 3306, 27017, or 1433, if no other tunnel on that server uses it.
Choosing the database's default port as the Server Port is convenient because clients can then use their default port value. For SQL Server with Server Port 1433, clients can leave out the port entirely.
This message appears when you try a Balance-only feature, such as Is Reserved?, Server Port › Change, Custom subdomain, or IP Restriction, on an account without Balance. The basic tunnel still works, so for a Free plan session expect a new port after each start and send the teammate the current Server Port.
Database-specific authentication and permissions
Configure the database separately from the tunnel. The examples use team_share, development_db, and other placeholder values. Generate a unique password and deliver it through an approved secure channel rather than code, chat, tickets, or screenshots.
PostgreSQL
Tunneled connections reach PostgreSQL from the Localtonet client, which is a local address. If pg_hba.conf has a trust rule for 127.0.0.1/32 or ::1/128, anyone who reaches the tunnel is let in without a password.
PostgreSQL picks the authentication method from the first pg_hba.conf rule matching the connection type, database, user, and source address. Through the tunnel, the address is 127.0.0.1 when the client runs on the PostgreSQL machine. The matching rule must require a password:
# TYPE DATABASE USER ADDRESS METHOD
host development_db team_share 127.0.0.1/32 scram-sha-256
Replace any trust rule for 127.0.0.1/32 or ::1/128, then reload PostgreSQL, for example with SELECT pg_reload_conf(); as a superuser or your service manager's reload command. Run the local test again and confirm psql asks for a password.
listen_addresses can stay at the default 'localhost' when the Localtonet client runs on the same machine, which keeps the tunnel as the only path from outside. If the client runs on another device, use that device's address in the pg_hba.conf rule and set listen_addresses so PostgreSQL also listens on its own network address.
Do not share the postgres superuser. An administrator can create a read-only role for one database and schema:
CREATE ROLE team_share LOGIN PASSWORD 'GENERATE_AND_DELIVER_SECURELY';
GRANT CONNECT ON DATABASE development_db TO team_share;
-- Run the following while connected to development_db.
GRANT USAGE ON SCHEMA public TO team_share;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO team_share;
The role needs a password: a role created without one cannot sign in with scram-sha-256. The table grant covers existing tables only. An owner that creates future objects can set default privileges:
ALTER DEFAULT PRIVILEGES FOR ROLE OBJECT_OWNER IN SCHEMA public
GRANT SELECT ON TABLES TO team_share;
Write access needs more care. Inserts into tables backed by sequences require sequence privileges, and functions or additional schemas have their own permissions:
GRANT INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO team_share;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO team_share;
For TLS, set ssl = on with a certificate on the server and have clients connect with sslmode=require (see the security section).
Before dropping the role, let its sessions close, revoke default privileges that mention it, and inspect ownership. DROP ROLE fails if the role owns objects or still holds privileges. REASSIGN OWNED and DROP OWNED have broad consequences and must be reviewed in every affected database.
MySQL and MariaDB
MySQL accounts are a user name plus the host the connection comes from. Through the tunnel, every connection comes from the Localtonet client, so the host portion is:
'localhost'when the client runs on the MySQL machine,'127.0.0.1'instead if the server runs withskip_name_resolveon,- the client device's LAN address when the client runs on another device.
Do not create 'team_share'@'%' to make the tunnel work. A read-only account for the common case looks like this:
CREATE USER 'team_share'@'localhost'
IDENTIFIED BY 'GENERATE_AND_DELIVER_SECURELY'
REQUIRE SSL;
GRANT SELECT ON development_db.* TO 'team_share'@'localhost';
SHOW GRANTS FOR 'team_share'@'localhost';
If write access is genuinely required, grant only the needed operations, as in our MySQL documentation:
GRANT SELECT, INSERT, UPDATE, DELETE
ON development_db.*
TO 'team_share'@'localhost';
Because every visitor arrives as the same host, MySQL host rules cannot tell visitors apart. Filter visitors on the tunnel with IP Restriction instead. bind-address = 127.0.0.1 can stay when the client runs on the same machine.
Do not share root, and remove accounts without a password, since they would accept anyone arriving from the client's host. CREATE USER and GRANT take effect without FLUSH PRIVILEGES. At cleanup, use the exact host portion that was created:
DROP USER 'team_share'@'localhost';
MongoDB
A self-managed MongoDB server accepts every connection without a user name or password until you enable access control. A tunnel to such a server gives anyone who has its address full access to your data. This is the one step you cannot skip.
Create an administrator first, then enable authorization in mongod.conf and restart MongoDB:
security:
authorization: enabled
After the restart, a connection without credentials can no longer read or change data. The MongoDB manual describes the full procedure under "Enable Access Control". The default net.bindIp: 127.0.0.1 can stay when the client runs on the same machine.
An administrator can then create a user in the admin database with a role on only the database it needs:
use admin
db.createUser({
user: "team_share",
pwd: passwordPrompt(),
roles: [
{ role: "read", db: "development_db" }
]
})
Use readWrite only when modification is required, never an administrator role. Because the user lives in admin, clients set authSource=admin or --authenticationDatabase admin. If you created the user in another database, use that name instead.
If the server is a replica set, drivers receive the members' internal host names and try to reach them, which hangs or fails from outside. Add directConnection=true to the connection string. For TLS, configure net.tls on the server and add tls=true to the connection string.
After the session, remove the user from the database where it was created:
use admin
db.dropUser("team_share")
Microsoft SQL Server
On Express and Developer editions TCP/IP is off by default, and named instances such as SQLEXPRESS use a dynamic port. Configure a fixed port:
- In SQL Server Configuration Manager, open SQL Server Network Configuration › Protocols for <INSTANCE> and enable TCP/IP.
- In its properties, on the IP Addresses tab under IPAll, clear TCP Dynamic Ports and set TCP Port, for example to
1433. - Restart the SQL Server service.
Connect by port, not by instance name. A name such as HOST\SQLEXPRESS is resolved through the SQL Server Browser service on UDP port 1434, which the TCP tunnel does not forward.
Windows Authentication normally does not work for a client outside your Windows domain, so remote clients sign in with SQL Server Authentication. In SSMS, open the server's Properties › Security, select SQL Server and Windows Authentication mode, and restart the service. Get administrator approval before changing it.
CREATE LOGIN [team_share]
WITH PASSWORD = 'GENERATE_AND_DELIVER_SECURELY';
USE [development_db];
CREATE USER [team_share] FOR LOGIN [team_share];
GRANT SELECT ON SCHEMA::[dbo] TO [team_share];
Do not use sa, and disable or rename it, since SQL Server logins are a common target for password guessing. Avoid broad fixed database or server roles. Because connections arrive from the Localtonet client, SQL Server only has to accept local connections and Windows Firewall needs no inbound rule for port 1433 from the internet. Firewall rules and logon triggers that filter by client address cannot tell visitors apart, so use IP Restriction on the tunnel.
Cleanup removes the database user, then the login, after active sessions are handled:
USE [development_db];
DROP USER [team_share];
USE [master];
DROP LOGIN [team_share];
Connect from the teammate's device and verify safely
Use the host from the URL column and the current Server Port of the running tunnel. Do not send the AuthToken. The teammate needs only the public address, database name, username, TLS settings, and a password delivered separately.
TUNNEL_HOST: the public host name of the tunnelTUNNEL_PORT: the current Server PortTEAM_USERNAME: the restricted database accountDATABASE_NAME: the authorized database
| Client | Host and port format | Harmless verification |
|---|---|---|
psql, pgAdmin, DBeaver |
-h TUNNEL_HOST -p TUNNEL_PORT, or host and port fields |
SELECT 1; |
mysql, MySQL Workbench, DBeaver |
-h TUNNEL_HOST -P TUNNEL_PORT, or host and port fields |
SELECT 1; |
mongosh, Compass |
mongodb://TUNNEL_HOST:TUNNEL_PORT/DATABASE_NAME |
db.runCommand({ ping: 1 }) |
SSMS, sqlcmd |
tcp:TUNNEL_HOST,TUNNEL_PORT |
SELECT 1; |
PostgreSQL
psql "host=TUNNEL_HOST port=TUNNEL_PORT user=TEAM_USERNAME dbname=DATABASE_NAME sslmode=require"
psql asks for the password. In pgAdmin or DBeaver, enter the tunnel host in the host field, the Server Port in the port field, and set SSL mode to require.
MySQL or MariaDB
mysql -h TUNNEL_HOST -P TUNNEL_PORT -u TEAM_USERNAME -p --ssl-mode=REQUIRED DATABASE_NAME
The MariaDB client uses --ssl instead of --ssl-mode=REQUIRED. In MySQL Workbench or DBeaver, do not leave the port at 3306 unless you set the tunnel's Server Port to 3306.
MongoDB
mongosh "mongodb://TUNNEL_HOST:TUNNEL_PORT/DATABASE_NAME?tls=true" --username TEAM_USERNAME --authenticationDatabase admin
mongosh asks for the password, so it does not land in shell history. In MongoDB Compass, paste the connection string into the URI field of a new connection. Do not use the mongodb+srv:// form with a tunnel address, because it looks up DNS records a tunnel host name does not have.
SQL Server
In SSMS, open Connect to Server, enter TUNNEL_HOST,TUNNEL_PORT in Server name, set Authentication to SQL Server Authentication, enter the login and password, and select Connect. With sqlcmd:
sqlcmd -S tcp:TUNNEL_HOST,TUNNEL_PORT -U TEAM_USERNAME -d DATABASE_NAME
After the harmless query succeeds, test one permitted read. If the account is meant to be read-only, confirm that a write attempt is rejected, using an operation that cannot damage data.
Connection strings for applications
Reserved characters such as @, :, /, ?, #, or % in usernames or passwords must be percent-encoded per component in URI-style strings. If an application stores the string, reserve the port first so it survives restarts.
postgresql://TEAM_USERNAME:ENCODED_PASSWORD@TUNNEL_HOST:TUNNEL_PORT/DATABASE_NAME?sslmode=require
mysql://TEAM_USERNAME:ENCODED_PASSWORD@TUNNEL_HOST:TUNNEL_PORT/DATABASE_NAME
mongodb://TEAM_USERNAME:ENCODED_PASSWORD@TUNNEL_HOST:TUNNEL_PORT/DATABASE_NAME?authSource=admin&tls=true&directConnection=true
Server=tcp:TUNNEL_HOST,TUNNEL_PORT;Database=DATABASE_NAME;User Id=TEAM_USERNAME;Password=PASSWORD_FROM_SECRET_STORE;Encrypt=True;
These are structural templates. Add directConnection=true only for replica sets, and enable the MySQL driver's equivalent of required SSL. Never paste a real password into a shell, repository, screenshot, or chat.
Security controls for a publicly reachable database endpoint

Use database-native TLS
Localtonet tunnels are not encrypted end to end by default, so let the database encrypt the session. Credentials and query data then stay encrypted between the teammate's client and the database server.
| Database | Server side | Client side |
|---|---|---|
| PostgreSQL | ssl = on with a certificate |
sslmode=require, which refuses an unencrypted session |
| MySQL or MariaDB | Create the account with REQUIRE SSL |
--ssl-mode=REQUIRED, or --ssl for the MariaDB client |
| MongoDB | Configure net.tls |
tls=true in the connection string |
| SQL Server | Install a certificate for the name clients connect to | Encrypt=True |
With Encrypt=True, SQL Server clients check the server certificate against the name you connect to. A default installation uses a self-signed certificate that does not match the tunnel host, so the connection fails with a certificate error. For a test, you can add TrustServerCertificate=True; (in SSMS: Trust server certificate). The session is still encrypted, but the server's identity is not verified. For regular use, install a certificate for the connect name and do not leave trust-any-certificate settings in saved profiles. The same principle applies elsewhere: a certificate issued only for localhost will not match the tunnel host for clients that verify host names.
Restrict who can reach the endpoint with IP Restriction
Database address rules cannot distinguish visitors, because every connection arrives from the Localtonet client. Filter on the tunnel instead. In the tunnel's Settings, select IP Restriction › Manage, choose Allow only these, and add the addresses of the people and applications that connect. Use my IP fills in your current address. A single address, a CIDR range such as 10.0.0.0/16, or several entries at once are accepted, and changes apply right away. IP Restriction needs Balance.
Confirm the teammate's current public egress address, especially behind a corporate VPN, secure web gateway, or changing residential connection. IP Restriction supplements database authentication and never replaces it.
Bound the session with tunnel limits
The tunnel's Settings include Expiration Date, Bandwidth Limit, and Speed Limits. These cap how long and how much the tunnel can be used, so a forgotten tunnel does not stay open indefinitely and an expensive export cannot run unchecked.
Watch who connects
Request Log › Show lists the connections made to the tunnel with the visitor's IP address. Database logs will show the Localtonet client as the source, so the Request Log is where you confirm that only your teammate's address connected.
Deliver credentials separately
Send the tunnel host and port through your normal collaboration channel only if policy permits, and the password through an approved password manager or secret-sharing system. Never send the AuthToken.
Limit the data and privileges
Use anonymized or synthetic data. Grant only the schemas, tables, collections, and operations required. Avoid administrative privileges, user management, file-system access, replication permissions, server roles, extension installation, and schema ownership.
A tunnel is not a snapshot. If the account can write, remote inserts, updates, deletes, DDL, long-running transactions, and locks affect the same database you use locally. Back up important development state and agree on permitted operations before sharing.
Operate, monitor, and close the sharing session
Monitor the session
Keep the session time-bounded and supervised. Check that the tunnel's Connection column shows ON and that you shared the current Server Port. Use Request Log › Show to see which IP addresses connected, and the database's own session views to see what the account is doing. On the Free plan, remember that the tunnel stops after 30 minutes. If you start it again, the port may change and you must send the new one.
Ask the teammate to disconnect when the task is complete. An idle GUI client may hold a connection or reconnect automatically, and closing a query tab does not always end pooled or background connections.
Avoid destructive or disruptive work
Coordinate writes, migrations, locks, bulk imports, index operations, and schema changes. A harmless-looking query can still be expensive on a large table or collection. If the teammate only needs to inspect data, keep permissions read-only throughout. Normal transaction and locking rules still apply: Localtonet forwards the connection but does not change them.
Close access in the right order
- Ask the teammate to finish work, commit or roll back intentional transactions, and close the client.
- Review active sessions and end remaining remote sessions through an approved administration process if necessary.
- Stop the Localtonet tunnel and confirm it no longer shows ON.
- Delete the tunnel if it will not be reused.
- Revoke or drop the temporary database account after resolving ownership, grants, and dependencies.
- Remove IP Restriction entries, shared secrets, exported files, and saved connection profiles that are no longer needed.
Stopping the tunnel removes the public path, but it does not revoke database permissions or erase a password already shared. If a reusable account was exposed more broadly than intended, rotate its credential.
Troubleshooting common connection failures
Start every investigation with three checks: the tunnel is started and its Connection column shows ON, the client uses the current Server Port, and the database answers on the device at the tunnel's Local IP address and Local port. If you use IP Restriction, confirm the teammate's current address is in the list.
The connection is refused or times out
Confirm the Localtonet client is running on the selected device and the device is not asleep or offline. Verify that the tunnel's Device token belongs to the client on the database host or a device that can reach it. Copy the host and Server Port again from Your tunnels instead of relying on an old profile. Database-specific messages for this case:
- PostgreSQL: psql reports connection refused or a timeout.
- MySQL:
ERROR 2003: Can't connect to MySQL server. - MongoDB:
MongoServerSelectionErrororMongoNetworkError: connection timed out. For a replica set, adddirectConnection=true. - SQL Server: "A network-related or instance-specific error occurred" with error 53, 40, or 10060. Check that the address uses a comma (
tcp:HOST,PORT), not a colon or instance name.
The application lost its connection after a restart
The port is not reserved, so it changed when the tunnel or the client restarted. Turn on Is Reserved? in the tunnel's Settings (this needs Balance and a started tunnel), or update the port in the application.
The tunnel stopped by itself after half an hour
On the Free plan a TCP tunnel stops after 30 minutes. Select Start to begin another session and send the teammate the current Server Port, or add Balance to remove the session limit.
"You need to purchase balance to use this feature."
You tried a Balance-only feature such as Is Reserved?, Server Port › Change, Custom subdomain, or IP Restriction. Add Balance, or continue without that feature and use the other controls in this guide.
PostgreSQL errors
FATAL: no pg_hba.conf entry for host "127.0.0.1": the tunnel works and PostgreSQL answered, but no rule matches the Localtonet client's address with your user and database. Add thescram-sha-256rule shown earlier and reload.FATAL: password authentication failed for user "…": the tunnel works. Check the password and confirm the role has one, because a role without a password cannot sign in withscram-sha-256.- I was let in without a password: a
trustrule matches the client's address. Stop the tunnel, change the rule toscram-sha-256, reload PostgreSQL, then start the tunnel again.
MySQL and MariaDB errors
ERROR 1045: Access denied for user '…'@'localhost': the tunnel works and MySQL answered. The host in the message is the Localtonet client. Check the password and that an account exists for exactly that user and host.ERROR 1130: Host '…' is not allowed to connect to this MySQL server: no account matches the host MySQL sees. Create the account for the host named in the message.
MongoDB errors
MongoServerError: Authentication failed: the tunnel works. Check the password and thatauthSourcenames the database the user was created in, usuallyadmin. Percent-encode special characters in the user name or password.- I can read data without signing in: access control is off. Stop the tunnel, enable
security.authorization, restart MongoDB, then start the tunnel again.
SQL Server specifics
If connecting by HOST\INSTANCE fails, use the port instead, because SQL Server Browser on UDP 1434 is not forwarded. If TCP/IP was never enabled or the instance still uses TCP Dynamic Ports, fix it under IPAll and restart the service. Windows Authentication failures from outside the domain mean you need SQL Server and Windows Authentication mode and a SQL login.
The database runs in Docker
The host's 127.0.0.1 reaches a containerized database only if the container port is published. A mapping of HOST_PORT:CONTAINER_PORT means the tunnel's Local port should normally be HOST_PORT. Networking differs across Docker Desktop, native Linux, Compose, and orchestration platforms, so confirm with a local client test.
Access works locally but is blocked remotely
Review the tunnel's IP Restriction list. The teammate's apparent public IP may differ behind a corporate VPN or gateway, and Request Log › Show displays the address that actually arrived. Update the list only after verifying the correct source. The teammate's organization may also block outbound connections to unfamiliar ports. Follow their approval process rather than treating the tunnel as a way around policy.
The client reports a TLS or certificate error
Read the full error. Common causes are an untrusted authority, an expired certificate, a host name mismatch, or the server not offering TLS while the client requires it. For SQL Server, the default self-signed certificate does not match the tunnel host, so Encrypt=True fails validation. TrustServerCertificate=True is acceptable only for a test. For regular use, install a certificate for the connect name. For PostgreSQL, confirm ssl = on before using sslmode=require.
The connection succeeds but access is denied
Authentication and authorization are separate. A successful login can still lack permission on a database, schema, table, sequence, or collection. Add only the missing privilege. If a supposedly read-only account can modify data, stop the session and correct the grants before continuing.
Frequently asked questions
Does the database need to listen beyond localhost?
Not when the Localtonet client runs on the same device. PostgreSQL's default listen_addresses = 'localhost', MySQL's bind-address = 127.0.0.1, and MongoDB's net.bindIp: 127.0.0.1 can stay as they are, which keeps the tunnel as the only path from outside. The database still needs a working TCP listener. If the client runs on another device, the database must listen on an address that device can reach.
How do I keep the same port for my teammate or application?
The host name stays with the tunnel, but the port is assigned when the tunnel starts. Turn on Is Reserved? in the tunnel's Settings so the port survives tunnel and client restarts. This needs Balance and a started tunnel, and tunnels created while the account has Balance start with it on. With Balance you can also pick a specific free port under Server Port › Change, such as 5432, 3306, 27017, or 1433.
Can I share a database on the Free plan?
Yes, for short sessions. On the Free plan a TCP tunnel stops after 30 minutes and can be started again, and the port can be different after each start. Balance-only features such as Is Reserved?, Server Port › Change, Custom subdomain, and IP Restriction show "You need to purchase balance to use this feature." on a Free account.
Is traffic through the tunnel encrypted?
Tunnels are not encrypted end to end by default, so use the database's own TLS: ssl = on with sslmode=require for PostgreSQL, REQUIRE SSL with --ssl-mode=REQUIRED for MySQL (--ssl for the MariaDB client), net.tls with tls=true for MongoDB, and Encrypt=True for SQL Server.
Can I share a database running in Docker?
Yes, if the Localtonet client device can reach the container's database port. When the client runs on the Docker host, publish the container port to a host port and use that host port as the tunnel's Local port. Verify the mapping with a local TCP connection first.
Can two people use the database at the same time?
The database accepts concurrent connections if its own configuration and limits permit them. Clients remain subject to normal transactions, locks, isolation, connection limits, and permissions, so coordinate writes because both people work against the same live state.
Is a database password enough to secure the tunnel?
No. Use layered controls: organizational authorization, anonymized data, a dedicated least-privilege account, database-native TLS, and IP Restriction on the tunnel, which needs Balance. Database host or address rules cannot tell visitors apart because every connection arrives from the Localtonet client, so IP Restriction is the way to filter visitors. Stop the tunnel and revoke access promptly after the session.
Should I send my teammate the Localtonet AuthToken?
No. The AuthToken identifies your client device and must stay secret. The teammate uses the tunnel host and current Server Port plus the restricted database credentials and TLS settings.
Why does PostgreSQL work locally without a password but fail through TCP?
Your local command may use a Unix-domain socket and a socket-specific rule. A TCP connection matches a host rule in pg_hba.conf. Test with -h 127.0.0.1 and make sure the matching rule uses scram-sha-256. If a TCP connection also gets in without a password, a trust rule for a local address is in place and must be replaced before the tunnel runs.
Why does SQL Server not use port 1433 on my machine?
Named instances such as SQLEXPRESS use a dynamic port, and TCP/IP is off by default on Express and Developer editions. In SQL Server Configuration Manager, enable TCP/IP, clear TCP Dynamic Ports under IPAll, set TCP Port, and restart the service. Then connect with tcp:HOST,PORT, not the instance name.
Is stopping the tunnel sufficient cleanup?
Stopping the tunnel closes the public path, but it does not revoke database permissions or erase credentials already shared. Close active sessions, stop or delete the tunnel, then drop temporary accounts and remove IP Restriction entries and saved profiles that are no longer needed.
Prepare a controlled database sharing session
Verify your database over local TCP with a password, create a least-privilege account, enable database TLS, connect the Localtonet client, and start a TCP tunnel only for the authorized session. Reserve the port if an application depends on it, restrict visitors by IP, and close both the tunnel and the credentials when the work is done.
Get Started Free →Corrections & updates
Substantive changes approved by the Localtonet editorial team are listed transparently below.
Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.