Access sqlite from a remote server

前端 未结 8 1194
悲哀的现实
悲哀的现实 2020-11-28 15:05

I am wondering how i can access an sqlite database that is sitting a remote server.I have read threads discouraging it but i need to do it if its possible.

          


        
8条回答
  •  臣服心动
    2020-11-28 15:45

    While sqlite itself does not provide any network endpoints you can use a web gui such as sqlite-web.

    Assuming you have python installed you can install it with

    pip install sqlite-web
    

    Once installed, start the web interface with:

    sqlite_web my_database.db
    

    By default it runs on http://127.0.0.1:8080/ ie is only accesible from the localhost.

    To make it visible on your LAN/WAN start it with:

    sqlite_web --host 0.0.0.0 my_database.db
    

    While running with --host 0.0.0.0 is fine on your own home network, it's a really bad idea to do it on a public host (even though the app allows setting a password). For remote access on a public host it would be safer running it on 127.0.0.1 and then forward the port over ssh.

    Disclaimer: I am not affiliated with the author of the app. Just had the same need as the op and found the app on github.

提交回复
热议问题