mysql connection with sql developer - mysql

I try to create a mysql connection with sql developer on MAC.
I loaded the mysql driver.
I tried to create a connection
But I had the following error
Statut : échec -Echec du test : 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 resolved the issue by re installing the last version of mysql with the correct driver. Furthermore I had to execute the following mysql command
SET GLOBAL time_zone = '+8:00';

Related

MySQL database connections broke after DataGrip Upgrade (2021.3.x)

After upgrading DataGrip to version 2021.3.2, my existing db connections were broken. I connect to various DBs (Oracle, MySql) via an SSH tunnel configured to connect through an AWS bastion host.
After the upgrade - DataGrip suggested that the MySql driver had to be updated to Amazon Aurora MySQL driver and it no longer worked to connect where it worked before the upgrade.
Switching between drivers I get two separate errors:
First Error using Amazon Aurora MySQL (suggested driver after update)
[08000][-1] Could not connect to address=(host=localhost)(port=53929)(type=master) : (conn=57522706) could not load system variables[08000][1220] (conn=57522706) Connection is closed.
and second error using original MySQL driver
[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.
No appropriate protocol (protocol is disabled or cipher suites are inappropriate).
All of my connections worked immediately prior to the DataGrip upgrade - so seems that upgrade requires new drivers, which have a problem with the way I connect.
After some looking - it seems that Aurora has an existing race condition - found my answer here: https://jira.mariadb.org/browse/CONJ-824?focusedCommentId=165412&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-165412
My solution was to change my usePipelineAuth to false (not set prior) in the Advanced tab of the Data Sources configuration:
This fixed my connections and am back in business.
Finally, In my case, I fix the issue just replacing/using MariaDB Driver.

How to fix " [08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. "

I'm working on a PHP project using PhpStorm + DataGrip + MySQL + WAMP and since then was working normally with remote database with these configurations (see images):
but suddenly I'm getting this error:
[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. java.net.ConnectException: Connection refused: connect
Could someone knows what can I do to solve this error?
I already tried to do what I found here (Solving a "communications link failure" with JDBC and MySQL) and that did not work yet.
I expect to connect again normally to my database.
Hi this error is because you are running a MySQL version 5 or 8.0 and later. And your server is configured to use the protocol of TLS 1.2. So, you need to enable TLS Protocols.
Open Datagrip
Go to Properties
Data Sources > Advanced
In enabledTLSProtocol set the value:
TLSv1,TLSv1.1,TLSv1.2,TLSv1.3
Test connection. And should work!
edit the JDBC url and append this query parameter &enabledTLSProtocols=TLSv1.2

liquibase SSL peer shut down incorrectly

I have a problem integrating liquibase maven execution with a mysql 5.7 database provided by azure as a Service.
the error log is:
Failed to execute goal org.liquibase:liquibase-maven-plugin:3.0.5:status (default-cli) on project — : Error setting up or running Liquibase: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 575 ms ago. Remote host closed connection during handshake: SSL peer shut down incorrectly.
this is the connection string I give to liquibase:
jdbc:mysql://server-name:3306/db-name?useSSL=true&requireSSL=false
Any suggestion?
I have just tryed to set -Dhttps.protocols=TLSv1.1,TLSv1.2
but nothing changed..
Fixed issue using version 8.0.12 of mysql unit connector and updating jdbc URL with useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC for the jdbc time zone parameter
mysql on azure uses by default the ssl security protocol

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.

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