I can't Expose MySQL instance remotely

Hello, I’m sorry I have to start a thread, but I already lost direction after 3 days tinkering with this.

I already created a MySQL app instance, it running fine, but I want to be able to connect remotely using other Database management software like TablePlus, etc.

I tried to connect as usual using IPv4, exposed port 3306, created mysql user profile with @‘%’ allowed host and grant all accesses like mentioned above. I still stuck.

ERROR 2013 (HY000): Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0

I have spent days reading thru other threads and topics, there are guidances about exposing Postgres but not about MySQL. I will appreciate any inputs! Thanks.

Here’s my fly.toml file:

# fly.toml file generated for wolfbank on 2022-12-04T16:42:15+08:00

app = "wolfbank"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[mounts]
  source="mysqldata"
  destination="/data"

[env]
  MYSQL_DATABASE = "db_name"
  MYSQL_USER = "user"

[build]
  image = "mysql:8"

[experimental]
  cmd = [
    "--default-authentication-plugin", 
    "mysql_native_password", 
    "--datadir", 
    "/data/mysql",
    "--performance-schema=OFF",
    "--innodb-buffer-pool-size", "64M"
  ]
[[services]]
  internal_port = 3306
  protocol = "tcp"

[[services.ports]]
  handlers = ["http"]
  port = 3306

maybe add services.ports

[[services.ports]]
  port     = "10000"

I already have exposed port, check my fly.toml above.

I finally solve this problem using wireguard tunnel, i created a peer profile for my org, then i can use appname.internal as the host to connect from my local machine using TablePlus

1 Like