Accessing Database From Outside App

The proxy connection:
flyctl proxy 13306:3306 -a my-mysql

mysql -h localhost -P 3306 -u swiftinflow_user -ppassword swiftinflow_db

Access denied for user 'swiftinflow_user'@'localhost' (using password: YES)

also tried with this mysql -h 13306 -P 3306 -u swiftinflow_user -ppassword swiftinflow_db Error: Can't connect to MySQL server on '13306:3306'


:cry: i really need help with :point_up_2:. connect locally to the DB and import my data

You’re proxying your-app.internal:3306 to localhost:13306, and all your attempts seem to use localhost:13306.

Have you tried mysql -h localhost -P 13306 ... ?

I tried mysql -h localhost -P 13306 -u swiftinflow_user -p. same error.

I am able to SSH with fly ssh console. and access mysql. But when i tried it outside the app i get ERROR 1045 (28000): Access denied for user 'swiftinflow_user'@'localhost' (using password: YES)

Are you sure you have the right user and password? Access denied is not something we can help with exactly.

I can give you a few more ideas to troubleshoot this though:

  • Is MySQL listening on IPv6 in your VM? It needs to be bind to [::]:3306 for it to be accessible via the private network. If you fly ssh console into your db app, you can check ports with lsof -Pi | grep 3306
  • Is MySQL running locally already and bound to port 13306? That could cause issues that may not be reported by our proxy command.
  • Can you list open ports to make sure the proxy is listening on localhost:13306? lsof -Pi | grep 13306
  • Try connecting to your private network directly and then accessing your instance directly, not through localhost, via swiftinflow_mysql:3306

The 4th point private network directly worked for me. I wanted something simple with the proxy but this is also cool. Thanks