access Database with HeidiSql like PHPMyAdmin (localhost) - database

is it possible to access a Database with HeidiSql like PHPMyAdmin, if the DB is only reachable over the web (localhost-Settings).

Yes, HeidiSQl is the BEST FREE mysql client on Windows.
You can follow this steps:
STEP1: Create a session, Network type choice "MySQL (SSH tunnel)". Hostname/IP as "localhost".
User as "yourmysqllocaluser", so was Password.
STEP2: Select SSH tunnel tab, choice your plink.exe location. SSH host+port use "Remote IP address" and port. Username as "Remote Linux ssh login user", so was Password. If you use Putty Pagent+ssh KEY, then leave the Password field and Private key file blank!
STEP3(IMPORTANT): Use your putty.exe access the Remote IP address, it will prompt a ssh access grant window. Be sure to choice "YES".
STEP4: Back to HeidiSQL, select session and open. Enjoy it as local.
If you havn't do STEP3, open session will occour error.

Since quite a few releases, HeidiSQL natively supports SSH tunnel connections. Just select network type MySQL (SSH tunnel) in your session, and set up putty in the upcoming SSH tunnel tab.
This is documented in detail on http://www.heidisql.com/help.php#connecting

Related

Connect to database through two ssh tunnels in IntelliJ IDEA

I'm trying to add a postgresql database as a datasource in IntelliJ IDEA Ultimate.
I've worked with a datasource through ONE ssh tunnel already. But now the database server is behind a firewall which only accepts ssh connections from a management server. The only way to access the db server goes over the management server.
So I (or IntelliJ) have to connect via ssh to this server and then, by using another user, tunnel via ssh to the database server.
Everything clear? :-D
The problem is, that IntelliJ offers only to configure one ssh tunnel. But after the first tunnel I need to use a second one, to finally connect to the database server...
Any Ideas?
Thx in advance.
I'd create a local port forward using OpenSSH or any similar tool which will forward 127.0.0.1:2222 to firewall:22 via the Management Server, then use IntelliJ IDEA tunnel configuration to 127.0.0.1:2222 like you would do with the single tunnel.
ssh -L 127.0.0.1:2222:firewall:22 <management server>
You can configure an External Tool to automate this process. On Windows machine I had great experience with Bitvise SSH Client for creating tunnels/port forwards and starting them automatically.
ssh supports your scenario out of the box. The trick is to create two entries in your ~/.ssh/config file for the management server, one for your-user and one for special-user. Then use ProxyJump to chain your connections together.
So, start by setting up a Host section for the management server and the user your are connecting to from your local machine:
Host mgmt
HostName management.server.com
User your-user
...
Then, set up a Host for the user on the management server that you will be logging in as:
Host mgmt-special-user
HostName management.server.com
User special-user
To this same host, add a directive to tell ssh to create a tunnel to your DB:
LocalForward <free-port-on-your-box> <db-ip-or-host>:<db-port>
Then tell ssh that this host can be reached from the first host:
ProxyJump mgmt
You can now ssh mgmt-special-user from your local machine. ssh will automatically jump through the mgmt host, and will also automatically extend the tunnel through mgmt and back to your local machine.
ProxyJump (-J) was added in OpenSSH 7.3 (released in 2016).

Accessing an external remote postgres database using pgadmin4 from a local machine produce password authentication fail

I am trying to connecting to a remote database with pgadmin4 using putty to portforward so I can connect to a local database on a remote server. This works normally like a charme.
I switched computer and set up the database setting and putty the same. (db: pgpass.conf on old maching with copy&paste to new db connection setting in pgadmin4 and a configuration file export/import for putty - that is 1:1 transfair).
When trying to connect to the remote local database, on the old computer it still works and on the new one i get this error message:
FATAL: password authentication failed for user "postgres" FATAL:
password authentication failed for user "postgres"
On Windows 10 I don't find the password file? Is there any? What is wrong with the setting in pgadmin4?
Found the solution, I don't have SSL so I have to disable it, and the connection is established.
Go to the servers properties, select the tab Connection go to SSL mode and choose Disable - finally Save it

Forward SQL Server ODBC over SSH via putty

I would like to access a Azure SQL database. It is accessible on port 1433. However, the firewall is blocking this request. Therefore, I wold like to tunnel my connection.
Setup
The client is running on Windows 10. I can connect to a remote linux server. This server runs at home and when I'm at home, I am able to access the SQL database. So I assume my linux server is also able to connect to the Azure database.
Tunnel request?
I want to access the database via an ODBC connection. So, I tried to tunnel the connection using putty:
Putty connects to linux server and tunnels localhost:2433 to server-url:1433
Client connects to localhost:2433
Client has access to database
However, this is not working.
What goes wrong?
I am able to connect using putty to linux server.
I have setup a tunnel inside putty at the Connection > SSH > Tunnels page:
Source port: 2433
Destination: server-url:1433
I have set the radio buttons to Local and auto.
What goes wrong here? I don't know how I can investigate this properly. Maybe there is a problem at my linux server, that it can't connect to Azure SQL. But I think my tunnel is not working correctly. Can you help?
I didn't get it to work with putty, but if you have access to a shell you can use
ssh -L <local_port>:localhost:<remote_port> user#server -i "path to your private key file if you need one for authentification"
So in your specific example it would be
ssh -L 2433:localhost:1433 user#server-url
I used this to create an ODBC connection from RStudio (you can use the built in terminal to establish the tunneling) to a postgres db running in a docker container on azure.

Unable to connect Plesk MySQL from remote server

I am trying to connect to Plesk MySQL server from another server. I am trying to access it using IP address But It always gives the error like.
"Can't connect to MySQL server on 'xx.xxx.xxx.xx' (4)"
Remote access setting of MySQL server are ."Allow remote connections from any host"
Here's the steps to "Allow remote connections from any host" :
Open a DOS command prompt on the server.
Run the following command from the mysql\bin directory:
{mysql -u root --password=}
A mysql prompt should be displayed.
To create a remote user account with root privileges, run the following commands:
{GRANT ALL PRIVILEGES ON . TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';}
'USERNAME' is the username to be created.
'IP' is the public IP address of the remote connection.
'PASSWORD' is the password to be assigned for this username.
(IP can be replaced with % to allow this user to logon from any host or IP)
mysql> FLUSH PRIVILEGES;
mysql> exit;
Edit /etc/my.cnf and change to (via ssh):
bind-address = ::
And restart db:
service mariadb restart
Long story short. You can't. Your provider does not have that featured enabled. Switch to cPanel providers.

Is possible to manage an OpenShift Database with pgAdmin?

Today I want to know if it is possible to manage a PostgreSQL on OpenShift using pgAdmin, in the same way that we can manage an Amazon RDS database?
Use port forwarding on your local machine to establish a connection to your remote server:
rhc port-forward -a applicationName
Now check the output on your command line to which port the postgres database service is mapped, if available this will be 5432 by default.
A step by step documentation about port forwarding is available at Getting Started with Port Forwarding on OpenShift.
Another way would be to configure the ssh-tunnel into your connection.
Tunnel-Host would be your applications name
Username the beginning string, when ssh'ing to that connection: XXX#application-name
Identity file would be id_rsa in .ssh fodler in your home directory
password your openshift password

Resources