On FTP, the site and the database are located (in a specific directory), and the database refers to the site as localhost .

How do I connect remotely?

I have full access to FTP and the actual database data. I want to connect via Workbench.

  • one
    So can a hoster ask or faq him to read? On my hosting, for example, remote access to the database is prohibited. - slava

3 answers 3

You need the ip of your server (hosting) where the site is located, if for the site localhost database, it means they are on the same ip. So you connect, the only thing some hosters in your personal account have is an item that allows \ forbids remote connection to the database, if there is no item, write them and say I want to connect remotely and you will be happy.

    if your hosting plan does not allow access via ssh and denies remote access directly to the database - in any way (except for very perverted solutions)

    I highly recommend not doing this kind of thing, if you are not ready to properly configure ssl to connect to mysql, deny connection without ssl, etc. simply because without ssl all your data will be transmitted in the open form, and anyone can connect with brute force or some kind of bug in mysql / crookedly configured permissions

    the correct hosting will prohibit the connection to the database not from the local network.

    Three options:

    • if you have the ability to connect via ssh to a hosting service, you can forward the connection through an ssh tunnel to mysql, you can connect a local mysql client like mysql-workbench / phpmyadmin (but usually access from phpmyadmin is provided). but quite real and safe solution.

    • Log in to the hosting in ssh and already through it you work in the console mysql-client. Fast, but if you really need a workbench - not very convenient.

    • if you have a cloud hosting of a digital ocean virtual machine or a dedicated server, you can install something like openvpn, add your client computer to the network and allow any connections within the virtual network. Safe and fast.

    You may be tempted to allow mysql login only from certain ip-addresses, but all your data will still fly across the Internet in clear text

    if you really need direct access to the database using the workbench and you often dig into the database, then maybe you should deploy a copy of the site on your computer - using wamp / lamp / docker, then you can experiment with the base before Upgrade site.

    ps most professional coders I know work with the database through the console client, and the workbench is used to

    • check syntax errors (it is very convenient to mark a line with an error)
    • format the request into a beautiful view (ctrl + b)

    pps What does "DB (in a specific directory)" mean? can you see the database files via ftp?

      In general: Setting up a remote connection to MySQL

      specific case depends on your hosting