Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

External MySQL

Scheduled Pinned Locked Moved Solved Support
mysql
7 Posts 4 Posters 527 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Trankery
    wrote on last edited by girish
    #1

    Hello.

    I just quickly wanted to ask how I'd get access to my Lamp Stack's DB from outside (minecraft server).

    I've opened the 3306 port in ufw and I edited the my.cnf.

    Still can't reach it. What do I have to do?

    1 Reply Last reply
    0
  • girishG Offline
    girishG Offline
    girish Staff
    wrote on last edited by girish
    #2

    @Trankery The mysql that is allocated to apps is run as a separate container (named mysql) and is not accessible from the outside directly. Instead, what you can do is to use the CLI tool to access it - https://cloudron.io/documentation/custom-apps/addons/#mysql

    May I ask why you want to access it from outside? I can probably give a better solution depending on the use case. But if you want to access from your laptop/PC:

    1. Install the CLI tool - https://cloudron.io/documentation/custom-apps/cli/

    2. cloudron exec

      # mysql --user=${CLOUDRON_MYSQL_USERNAME} --password=${CLOUDRON_MYSQL_PASSWORD} --host=${CLOUDRON_MYSQL_HOST} ${CLOUDRON_MYSQL_DATABASE}
      
      mysql> this is the mysql shell
      
    1 Reply Last reply
    0
  • T Offline
    T Offline
    Trankery
    wrote on last edited by
    #3

    As I said, a minecraft server needs to access it.

    1 Reply Last reply
    0
  • T Offline
    T Offline
    Trankery
    wrote on last edited by
    #4

    Am I able to open this container to the outside?

    I don't really mind about security too much here.

    1 Reply Last reply
    1
  • girishG Offline
    girishG Offline
    girish Staff
    wrote on last edited by girish
    #5

    There is no easy way to make the internal mysql server public without changing the code and I don't know what that will break.

    I think you can setup a ssh tunnel between your minecraft server and the Cloudron.

    Something like https://www.linode.com/docs/databases/mysql/create-an-ssh-tunnel-for-mysql-remote-access/

    Do this on Cloudron:

    docker inspect mysql | grep IPAddress
                        "IPAddress": "172.18.0.4",
    

    So, 172.18.0.4 is the IP of mysql server. Then, you can get the db credentials using the web terminal of the LAMP app:

        env | grep CLOUDRON_MYSQL_
    

    You can then connect using the above credentials as:

    mysql --host=172.18.0.4 --user=<username> --password=<password> <db>
    

    After the above works, you just setup SSH tunnel accordingly.

    E 1 Reply Last reply
    1
  • E Offline
    E Offline
    eddowding
    replied to girish on last edited by
    #6

    @girish said in External MySQL:

    docker inspect mysql | grep IPAddress

    Where / how?

    1 Reply Last reply
    0
  • nebulonN Offline
    nebulonN Offline
    nebulon Staff
    wrote on last edited by
    #7

    By now the internal IP for mysql is hardcoded to 172.18.30.1 so this command is not required anymore: https://docs.cloudron.io/guides/connect-mysql/#internal-ip-address

    1 Reply Last reply
    2
  • nebulonN nebulon marked this topic as a question on
  • nebulonN nebulon has marked this topic as solved on

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks