On shared hosting, databases are designed to be accessed by websites running on the same server. For security reasons, direct access to MySQL from the Internet (port 3306) is typically restricted.
If you need to work with your database from your computer, use one of the safe options below.
This is the easiest way for imports/exports, editing tables, running queries, etc.
An SSH tunnel lets your database client connect to 127.0.0.1 on your computer, while the traffic is securely forwarded to the database on the hosting server.
Open Terminal and run (replace placeholders):
ssh -L 3307:localhost:3306 USERNAME@SERVER_HOSTNAME -p 22
Then connect your DB client to:
127.0.0.13307Why port 3307? It avoids conflicts if your computer already runs MySQL on port 3306.
3307localhost:3306In your DB tool, connect to 127.0.0.1:3307.
If you need an application outside the hosting server to connect to MySQL directly (for example, from an external server), shared hosting may not be suitable. Consider hosting the application and database on a VPS.