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.
Related
I have an instance of Apache NiFi running on the windows machine. I have failed to connect it with the MySQL database which is running on localhost and is accessible from any host.
I have attached the configurations of the connection
I tried to change the class name from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver and vice-versa without success, I also tried to change the Database connection URL port from 3306 t0 33061 and vice-versa also without any success.
on the bulletin board am getting the error "No suitable driver for the given Database Connection URL: No suitable driver for the given Database Connection URL and the status is stuck on enabling even after restarting the apache NiFi.
Please assist am stuck in here.
ps: I don't have password set for the root user of my database
typo in url - you have jbds instead of jdbc
I have a MySQL server (v8.0) running on windows server 2016. I also have IIS running and PHPMyAdmin installed. In addition to this, I have a PHP web application which runs on the same server (under IIS) which accesses the MySQL database. Finally, I have several Python scripts which access the MySQL database.
Somehow, I have lost the ability to access the database from the Python scripts, but the web application still works and PHPMyAdmin can see and modify the database.
Even more strangely, I can no longer user MySQL Workbench to access the server from a PC on the local network, and PHPMyAdmin cannot access the users table of the mysql database. I can't change user details at all through PHPMyAdmin, I get the error:
Error in processing request
Error code: 500
Error text: Internal Server Error (rejected)
It seems that the connection to server has been lost.
MySQL Workbench gives me this error:
Your connection attempt failed for user 'user' to the MySQL server at SERVERADDRESS:PORT:
Access denied for user 'user'#'SERVERADDRESS' (using password: YES)
I have checked that the server can accept connections from remote computers by adding bind-address=0.0.0.0 to the my.ini file. I have also checked to ensure that 3306 is allowed through the firewall.
Any ideas on what could be causing this issue?
ADyson and MrApnea pointed me in the right direction.
The problem was caused by my main database user having the host reset from % to localhost, I'm not sure how this happened or when. As the app was running locally, this was not affected, but all other access was denied (including MySQL workbench). My root user is set to local only for security.
To fix this, I connected to the server via RDP and logged in to the console as the root user. I then ran these commands to see the error:
use mysql;
select host, user from user;
This showed me that the main user account had "localhost" in the host. I ran this command to update this user:
update user set host='%' where user='username' and host='localhost'; flush privileges;
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.
I have Adobe ColdFusion 10 installed on my computer and registered with a free website on 000webhost.com. However, when I tried to connect I got this error:
Connection verification failed for data source: ssss
java.sql.SQLException: Timed out trying to establish connection The
root cause was that: java.sql.SQLException: Timed out trying to
establish connection
This is what I typed in the ColdFusion connector:
CF Data Source Name: ssss
Database: a9156701_25
Server: mysql3.000webhost.com Port 3306
Username: a9156701_sayood
Password: *******
I don't know if the problem is with the free web host or the way I added the data source.
Your datasource looks correct. You are not allowed to connect remotely to the database. I found this mentioned in their forums:
11-12-2013, 05:45 PM: Are you trying to connect remotely? (not
allowed) Your files have to be on the server.
I have a MySQL database I'm able to connect via the command prompt and the MySQL administration tool but using the same credentials in a Web application in a Tomcat server on the same server gives me this error:
javax.servlet.ServletException: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
Which I recognize as an incorrect credentials issue. I checked that the MySQL server is listening on port 3306 using netstat. I don't have the mysql root credentials but I created a new account and granted all priviledges to it and are the ones used to connect both using the command prompt and the MySQL admin tool.
Turned out to be a caching issue. Disabled the context caching in the web application in order to "see" the changes. Windows doesn't show this behavior/issue.