Handshake inactivity timeout while using VSCode SQL Tools - mysql

I'm using the SQL Tools extension for VSCode to connect to my database which is hosted on a Debian VM and whenever I try to connect to it, I always get a timeout error.
[1664037417336] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1664037417336] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1664037417337] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1664037417337] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1664037417338] INFO (ls): REQUEST RECEIVED => connection/GetConnectionPasswordRequest
[1664037422395] INFO (ls): REQUEST RECEIVED => connection/ConnectRequest
[1664037422395] INFO (ls): Connection instance created for Social Bot (dev).
ns: "conn-manager"
[1664037432398] ERROR (ls): {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}},"name":"Error"}
ns: "conn"
[1664037432399] ERROR (ls): Connecting error: {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}},"name":"Error"}
ns: "conn-manager"
[1664037432399] ERROR (ls): Open connection error
ns: "conn-manager"
[1664037432401] ERROR (ext): ERROR: Error opening connection Handshake inactivity timeout, {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}}}
ns: "error-handler"
This is what my connection config looks like:
Why does this happen?

Related

cURL error: Failed to connect to xxxxxx(bucketname) port 80: Connection timed out (7)

I am uploading a file to Alibaba Cloud - OSS bucket. Have correct access key and secret key.
Using oss-sdk-php through yii2, Getting Error
{"name":"PHP Fatal Error","message":"Uncaught exception
'OSS\Core\OssException' with message 'RequestCoreException: cURL
resource: Resource id #351; cURL error: Failed to connect to
chinaproduct.oss-cn-beijing.aliyuncs.com port 80: Connection timed out
(7)'
Unable to get exact issue, any help would be appreciated.
// #### Delete old files / Fetch all files with prefix
$listObjectInfo = $ossClient->listObjects($productBucket,array('prefix'=>$uploadProductPrefix));
$objectList = $listObjectInfo->getObjectList();
foreach ($objectList as $objectInfo) {
$fileNameToDelete = $objectInfo->getKey();
$ossClient->deleteObject($productBucket,$fileNameToDelete);
\Yii::info("OSS : Deleted file from OSS -$productBucket - $fileNameToDelete");
}
} catch (OssException $e) {
\Yii::info("OSS : Unable to delete old files from OSS $productBucket for dataId $dataId " . $e);
}

How can I interact with a RDS MySQL instance with Node.js Lambda function?

I am attempting to access a MySQL database hosted on amazon RDS through amazon Lambda. I have .js files that I can run through cmd line on windows, but when I transfer to Lambda, I cannot connect to the database. I researched this issue thoroughly, and even after following this guide: Redstapler AWS, I receive a "process exited before completing request" error message.
My Code, copied from the above tutorial
var mysql = require('mysql');
var pool = mysql.createPool({
host: "",
user: "",
password: "",
database: ""
});
exports.handler = (event,context,callback) => {
context.callbackWaitFOrEmptyEventLoop = false;
pool.getConnection(function(err,connection){
if (err) throw err;
connection.query("SELECT * FROM testdata limit 10",
function(error,result,fields){
connection.release();
if (error) callback(error)
else callback(null,result)
});
});
};
Error Message received from Amazon Lambda
Response:
{
"errorMessage": "RequestId: b5151db1-6db8-11e8-8004-1b9e8072561c Process exited before completing request"
}
Request ID:
"b5151db1-6db8-11e8-8004-1b9e8072561c"
Function Logs:
START RequestId: b5151db1-6db8-11e8-8004-1b9e8072561c Version: $LATEST
2018-06-11T20:48:01.478Z b5151db1-6db8-11e8-8004-1b9e8072561c Error: Handshake inactivity timeout
at Handshake. (/var/task/node_modules/mysql/lib/protocol/Protocol.js:164:17)
at emitNone (events.js:86:13)
at Handshake.emit (events.js:185:7)
at Handshake._onTimeout (/var/task/node_modules/mysql/lib/protocol/sequences/Sequence.js:129:8)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
--------------------
at Protocol._enqueue (/var/task/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Protocol.handshake (/var/task/node_modules/mysql/lib/protocol/Protocol.js:52:23)
at PoolConnection.connect (/var/task/node_modules/mysql/lib/Connection.js:130:18)
at Pool.getConnection (/var/task/node_modules/mysql/lib/Pool.js:48:16)
at exports.handler (/var/task/main.js:11:6)
END RequestId: b5151db1-6db8-11e8-8004-1b9e8072561c
REPORT RequestId: b5151db1-6db8-11e8-8004-1b9e8072561c Duration: 10074.63 ms Billed Duration: 10100 ms Memory Size: 1280 MB Max Memory Used: 27 MB
RequestId: b5151db1-6db8-11e8-8004-1b9e8072561c Process exited before completing request
This tutorial is highly rated and seems reputable, but I am unable to replicate its success. The error seems to imply that the connection.release is located in the wrong spot, or that I need to have another way of ending the connection and returning it to the pool.
Check to see that RDS instance security groups allow access from lambda IP address range (https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html) or place the lambda in VPC from which RDS instance is accessible.By default lambda is not in VPC...
Similar question:
updated : AWS Lambda is not able to connect to MySQL
Put console log statements to know if you are able to connect to RDS or not.
...
connection.release();
console.log(result);
if (error) callback(error)
...
Make sure you call pool.end() before calling callback function else lambda function execution won't be exited properly so you will get the timeout error.

Error when migrating database using edeliver

I've always used edeliver to deploy my apps, but on my new app, I'm getting a weird error.
When I run mix edeliver migrate production, I'm getting this response:
EDELIVER MYPROJECT WITH MIGRATE COMMAND
-----> migrateing production servers
production node:
user : user
host : example.com
path : /home/user/app_release
response: RPC to 'myproject#127.0.0.1' failed: {'EXIT',
{#{'__exception__' => true,
'__struct__' =>
'Elixir.ArgumentError',
message => <<"argument error">>},
[{ets,lookup_element,
['Elixir.Ecto.Registry',nil,3],
[]},
{'Elixir.Ecto.Registry',lookup,1,
[{file,"lib/ecto/registry.ex"},
{line,18}]},
{'Elixir.Ecto.Adapters.SQL',sql_call,
6,
[{file,"lib/ecto/adapters/sql.ex"},
{line,251}]},
{'Elixir.Ecto.Adapters.SQL','query!',
5,
[{file,"lib/ecto/adapters/sql.ex"},
{line,198}]},
{'Elixir.Ecto.Adapters.MySQL',
'-execute_ddl/3-fun-0-',4,
[{file,"lib/ecto/adapters/mysql.ex"},
{line,107}]},
{'Elixir.Enum',
'-reduce/3-lists^foldl/2-0-',3,
[{file,"lib/enum.ex"},{line,1826}]},
{'Elixir.Ecto.Adapters.MySQL',
execute_ddl,3,
[{file,"lib/ecto/adapters/mysql.ex"},
{line,107}]},
{'Elixir.Ecto.Migrator',
'-migrated_versions/2-fun-0-',2,
[{file,"lib/ecto/migrator.ex"},
{line,44}]}]}}
But when I type mix edeliver restart production followed by the migration command, everything goes normally. Why is this happening?

teiid doesn't connect to mysql datasource

I have a problem on connecting to a mysql datasource from JBoss EAP 6.3 with Teiid 8.10.1 copied over it. I need to mention that I've copied mysql connector driver as a module for using mysql datasource.
Also, when I try with JBoss EAP 6.3 without Teiid, the connection works.
Anybody that confronted the same problem?
This is the error message I receive in administration console of JBoss:
"Unknown error
Unexpected HTTP response: 500
Request {
"address" => [
("subsystem" => "datasources"),
("data-source" => "database")
],
"operation" => "test-connection-in-pool" }
Response
Internal Server Error {
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
"rolled-back" => true }"
Need to mention that in logs I don't receive a more verbose message for the error, with all logs enabled(Trace, Debug, Error, etc).

Error when adding SSL array inside connection string in PHP PDO

I need to establish an SSL connection between MySQL server and PHP web application.
Currently we are working with offline server (wampserver) and we need to establish an SSL connection. Th moment I changed the connection script from:
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8mb4");
To:
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass, array(
PDO::MYSQL_ATTR_SSL_KEY =>'/etc/mysql/ssl/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT=>'/etc/mysql/ssl/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA =>'/etc/mysql/ssl/ca-cert.pem'
));
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8mb4");
an error appeared on the login page saying:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in C:\wamp64\www\
EDIT
I run this query:
show variables like '%ssl%'
And got the following result: