Connecting MySQL remote url to spring boot application - mysql

I am trying to connect to my remote MySQL database which is on the server, in my application.properties I have following config
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:mysql://www.mydomain.com:3306/my_database_name
spring.datasource.username=my_username
spring.datasource.password=my_password
But i get this error
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Can anyone please tell me what am i doing wrong ?

Make sure remote connection is enabled on MySQL server ( Try connecting from workbench or other sql client from your local machine with above username and password to test if remote connection is active. Activate if not active
Make sure port 3306 is open on server ( in firewall of server)
Make sure domain is getting resolved correctly ( ping www.my_domain.com

Related

intellij idea connecting to mySql

thanks in advance
I have a cpanel host and I have created a MySQL database on it.
I was trying to connect to MySQL via IntelliJ Idea... for using it in Spring boot and etc but all the time I try I get connection fail error:
Connection to taxirkar_nettodb#109.169.71.144 failed.
[08S01] Communications link failure.
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
I'm getting my host IP from my cpanel host by going to "server information" and grabbing the shared IP
I have created a DB in Cpanel with name of : "nettodb".
I have assigned a user with name of "tara" to it.
the host is : "taxirkaran.com".
And my host username is : "taxirkar".
what else should i do? what I'm doing wrong?
there is the picture of my settings in intelli :
https://drive.google.com/file/d/1xJO-cRb139jq71K48aWnYpZQY4mdtl_2/view?usp=sharing

Jira: Error connecting to database

I created a MySQL RDS instance at AWS(Amazon web services).When I tried to test connection(Database) during the "Jira" installation, I am facing the below issue:
Error connecting to database
Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Connection timed out: connect
when I tried to connect through MySQL localhost I am facing the below issue:
Error connecting to database
Unknown system variable 'storage_engine'
Try to remove 'storage_engine' variable from db url in /var/atlassian/application-data/jira/dbconfig.xml.
New mysql does not support this parameter as it is default engine now.

Mysql access over LAN

I have created a java application which connects to a mysql database using the JDBC driver. I have the mysql server running on the same machine as my java application.
When I connect to the database on localhost the application is working fine. My system in connected to other systems via LAN. Now i want to run my application on these systems connecting to the database on the mysql server i have on my system.
What changes do i need to make in my mysql workbench or the java application to deploy this. I have mysql 6.1 workbench installed.
I am getting the following error:
run: Communications link failure
Last packet sent to the server was 0 ms ago. Exception in thread
"AWT-EventQueue-0" java.lang.NullPointerException
at help.helpdesk.Ready(helpdesk.java:97)
at help.helpdesk.<init>(helpdesk.java:89)
at help.helpdesk$6.run(helpdesk.java:428)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) BUILD
SUCCESSFUL (total time: 22 seconds)
when I try to connect to the database on my local server by using the ip address of my system.
If you set bind-address = 0.0.0.0 in /etc/my.cnf, MySQL will be available across all interfaces both locally and over the network.
You need to do following changes
1.Edit the my.cnf
mysql/my.cnf
change the local ip
bind-address = 192.168.1.2("your system ip")
2.restart the mysql server
and if you want connect to your database remotely than this link will helpful for you

Openshift DB connection issue

I'm trying to connect mysql db in openshift from my application as below ,
new DriverManagerDataSource("jdbc:mysql://localhost/dbXXXX?autoReconnect=true", "usernameXXX", "pwdXXX");
However an error was thrown as
om.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Any idea , whats the reasonn
If this is a scaled application, then you need to also supply the port, as it won't be 3306. Otherwise try restarting the mysql cartridge, or try sshing into your gear, and use the "mysql" command to see if you can connect, also try using the environment variables for your connection instead of the actual values. Also, localhost is wrong, ssh into your gear and run "env | grep MYSQL" and you will see the values that you should use.

Unable to connect to XAMPP MySQL from Netbeans

I am a windows 7 user and I'm having an issue with MySQL and XAMPP.
I use the MySQL that comes with XAMPP. I have changed the root password of MySQL using XAMPP's security page. Then I tried to connect to the MySQL server via Netbeans.
To try to connect I clicked on MySQL server option in the database drop down of the services pane, I gave it some settings:
server host name:localhost
username:root
port:3306
password:(my sql password)
path to admin module:(http:'//')localhost/phpmyadmin
sql start path:D:\D-drive\xampp-portable\mysql\bin\mysqld.exe(also tried mysql_start.bat)
sql stop path:</b>D:\D-drive\xampp-portable\mysql\bin\mysqladmin.exe(also tried sql_stop.bat)
Then I right click on MySQL server at localhost [root] and select Connect, this is when I get an error:
Unable to connect to the MySQL server:
org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server..
The server may not be running or your MySQL connection properties may not be set correctly. Do you want to edit your MySQL connection properties?
Changing localhost to 127.0.0.1 doesn't work either. I have the jdbc driver as well.
The fix that worked for me is as follows:
Please see that netbeans is an allowed program in your firewall as well as antivirus software
to check:
if netbeans startup page says "cannot connect to internet" then you must change your firewall and/or antivirus settings to allow it