Openshift mysql connection error channel timeout - mysql

I have an Tomcat 7 application on openshift and I have added a MySQL cartridge. I have a problem connecting to that database using MySQL workbench.
I have added all the necessary parameters like hostname, username, password and SSH key, I have tested the connection and I get no errors. But when I try to connect to the db I get the following error:
Your connection attempt failed for user 'adminxxxx' from your host to server xx.xxx.xxx.xxx:3306:
Tunnel error: Remote connection to xx.xxx.xxx.xxx:3306 failed: IOError('open SSH tunnel timeout',)
What can I do to fix this? Connecting to the db is a big part of the application.

Related

Connecting Jetbrains DataGrip to a remote database via SSH

I have an AWS Lightsail instance running the Bitnami configuration for Ubuntu 16.04.5 LTS and PHP7.
I can connect the the MySQL database using phpMyAdmin on the server via an SSH Tunnel. But when I try to configure DataGrip for SSH access to the database I receive the error message "Host '127.0.0.1' is not allowed to connect to this MySQL server".
When I remove "localhost" from the host field of the General tab then I receive the error "ExecutionException: SSH: Unable to find host/port in URL".
The following test and response appears to show a successful connection to the port:
cat < /dev/tcp/###.###.###.###/22
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
I'm using keypair auth. Both the user name and the Private key file are the same used for the ssh tunnel when running phpMyAdmin.
Not sure what to try next. Any help appreciated.

Linkedin WhereHows - Docker Backend not able to connect to MySQL

When I try to connect WhereHows backend to MySQL DB in Docker environment I am getting following error message (I checked IP, Username and Password and all 3 are good):
1) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [wherehows]]
At the same time, WhereHows web is connecting without any problem.
Docker version is 17.12.0-ce and I am using following images:
wherehows/backend
wherehows/web
wherehows/mysql
This is my config file - /backend-service/conf/application.conf
# connection to wherehows mysql database
db.wherehows.driver = com.mysql.jdbc.Driver
db.wherehows.url="jdbc:mysql://localhost/wherehows?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false"
db.wherehows.username="wherehows"
db.wherehows.password="wherehows"

Server side forclose me to connect with remote database

I have created SpringBoot application which connectes to the remote database mysql. I test it with two remote db connection: one has a dynamic IP, the second one has a permanent IP - it's a hosting.
Running locally:
When I try to run application locally (connection to DB with permanent IP), straightforward from Intellij everything works properly - in my browser I can see the application.
When I try to run the application with dynamic IP - I need to provide the host name instead of IP, the application throws:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Caused by: java.sql.SQLException: null, message from server: "Host 'HomeGateway' is not allowed to connect to this MySQL server"
Running on server:
When I try to run it on server eventhough I provide the connection to the host with dynamic IP or with pernament IP it also throws:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Caused by: java.sql.SQLException: Access denied for user 'root'#'localhost' (using password: YES)
The application.properties file looks like - the connection with database with dynamic IP:
# REMOTE DATABASE
spring.datasource.url = jdbc:mysql://modraszka.sth.sth:3336/test3?autoReconnect=true&useSSL=false
spring.datasource.username = root
spring.datasource.password = password
I must add that when the appication has been deployed at server, at the same server is located database - this one which has dynamic server - modraszka.sth.sth.
Summary:
Whenever I want to run the application from server which has connection to remote DB it always throws fails even when I want to connect to the DB which is located on the same server as my application. I also tried to run application with db properites connection as: localhost:3306/test3 -> but it also failed.

connecting to database fails with laravel mysql

my project is hosted in forge (digital ocean) laravel 5.1
I can connect (ssh) normally with putty using ssh file key by taping only the username but I fail when I try to connect to database with heidisql with the same ssh key file , I used to connect normally but the last month after a payment problem i always fail and i Get
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
and in the webpage I get
[PDOException] SQLSTATE[HY000] [2002] Connection refused
any solution please
solved by sudo service mysql restart

Cannot Connect to Database Server MySQL Workbench Tunnel Error

Every time I try to connect to my mySQL on mysql workbench, it gives me this error message saying:
Your connection attempted failed for user 'root' from your host to server at http:x.x.x.x:3306: Cannot open SSH Tunnel:Error connecting SSH tunnel:Error Connecting to SSH server Error 11004 get addrinfo failed
I think you could get solution here: http://quintagroup.com/services/support/tutorials/mysql-linux
or follow this steps:
Open putty and accept the certificate of the server
hostname should be localhost ( in order to use local socket and not http conection)
local port should be something like 33010 not 3306
local port is the conection back port used by the plink and has nothing to do with mysql ports