Access MySQL remotely 
In reality, you want to access MySQL | MariaDB from your computer to the server, or that server is Remote Database for everyone to use,...
Method 1: Open port 3306 (not safe 👀) 
Opening database port 3306 is the fastest way to make a connection to the remote database, however this is the least secure way, because now port 3306 is public, anyone can access this port to test. Password detector, if you set a weak password, it will be easily attacked.
To open port 3306, see instructions for using Firewall Rule
Method 2: Through SSH Tunnel (safe 👉 recommended) 
First you need to do create SSH Key and [add SSH Key to the server](../knowledge/ssh-keys.md# add-ssh-key-into-machine-chu)
Instructions for using HeidiSQL 
- Database configuration  - Click Newto create a new Session
- Enter notes for this Session
- Select Network type: MariaDB or MySQL (SSH Tunnel)
- IP: absolutely must be 127.0.0.1
- User: is the [database] user name (../server/database.md)
- Password: is the database user password
 
- Click 
- Configure SSH Tunnel  - Select the SSH Tunneltab
- Check the Use SSH Tunnelbox
- Select ssh.exe
- SSH Host + Port: enter server IP and SSH port
- Username: is the Linux system username that we choose when adding the SSH Key  
- Private key file: is the key added in step add SSH Key to server note: select private key is PuTTY (.ppk)
 
- Select the 
Instructions for using TablePlus 
After New Connection we configure as follows

- host: must absolutely be 127.0.0.1
- tag: set production (optional)
- user: this is the database user name
- password: this is the database user's password
- Choose to connect via SSH
- Server: your server ip
- Port: is the SSH port
- Username: is the Linux system username that we choose when adding the SSH Key
- Check Use SSH Key
- Select Private Key