last week I created a Node server with MySQL. Everything went fine. I was using the configvars to connect and made the whole mobile app with the endpoints.
Suddenly, today, Heroku decided to close the connection to MySQL database (ClearDB) and throw status 503 and Connection lost.
const mysql = require('mysql');
const db = mysql.createPool({
connectionLimit : 120,
host : 'hostFromHeroku.cleardb.net',
user : 'user',
password : 'password',
database : 'databaseName',
debug : false
});
db.getConnection((err,connection)=> {
if(err)
throw err; //THIS LINE THORS THE ERROR
console.log('Database connected successfully');
connection.release();
});
module.exports = db;
This is the HEroku console
I tried to connect dozens of times again and again... Dont know whats wrong.
I checked the clearDB portal and noticed that on the portal the connection dissapeared. Tried also to connect with MySQL workbench but the connection still cannot be established...
In the figure above there are still no connections... Checked the credentials few dozens of times....
Any ideeas? If anyone wants more pieces of code please let me know
Thanks, Daniel
I am currently having the same issue with ClearDB + heroku using Python/Django and it started today as well.
I do believe this is an issue with ClearDB or perhaps Heroku and not on your/our application side. See if you can connect to the database using some client like MySQlWorkbench for example. It probably won't work either.
I opened a ticket with both heroku and clearDB. I suggest you do the same. They must have messed up something
ClearDB is currently experiencing some issues.
Having the same issue over here that I'm unable to connect to my database using TablePlus/Sequel with the following error message:
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
And the Status/Dashboard indicates that the database is up and running.
Created an support ticket and got the following response:
Team is still working on the issue. We will update you once we have
next update.
Support response from 5/17/2022 08:36PM
Our support team continues to work on the issue on priority. they have
identified some issues with the shared MYSQL DB and AWS volumes. The
team is trying to fix the db node and resync the data which may take
some time. We will keep you updated with the service restoration
progress.
After 30h of downtime my database is back online again
Related
const mysql = require('mysql');
const dbConn = mysql.createConnection({
host: 'xx.xxx.xxx.xx',
database: 'ucha_txxxxxx',
user: 'ucha_axxxxxx',
password: 'txxxxxxxxxxxx',
port: 8090,
});
dbConn.connect(function (err) {
if (err) {
console.log("Error in connection request", err);
return;
}
console.log("Connection Successful-----------------------");
});
module.exports = dbConn;
This is my code for Database Connection. Initially I used phpMyAdmin localhost for testing my app, since I have to deploy my application, I have to change my database from localhost to a private server. I added the details of the private server and that is where I am facing the problems. I checked multiple times if I had entered the right details. I even tried using Pool but had the same issue. To check if my database connection has been established, I run
node index.js
in my terminal. It should display either of the two results written in dbConn.connect(), but I am getting neither. I even tried adding connection Timeout too but couldn't get any results. Please let me know if I am doing anything wrong.
FYI- I am using Webserver enter image description herefor hosting my database
Here is a screenshot of my code snippet.
I tried solutions from multiple websites and YouTube videos, even consulted my senior developer but couldn't get the expected result. I am hoping to get any kind of help from here.
Port 8090 is running a HTTPs Server on your IP, MySQL/MariaDB runs on Port 3306 (which is also open to anyone - more on that later)
The error you described shows that your user is not allowed with that specific IP (probably your IP address of your (home?-)router).
Usually you create user and permissions like this:
CREATE USER '<username>'#'<ip or host>' IDENTIFIED BY '<password>>';
GRANT ALL PRIVILEGES ON <database>.<table> TO '<username>'#'<ip or host>';
If you want to access it from any host you can use % as < ip or host >
WARNING: You should never ever access MySQL over the internet (which looks to me like you do). Usually you don't even want to expose MariaDB to the internet (bind-address in MySQL/MariaDB configuration)
You also have many other ports open to anyone in the world - please check if all of them need to be exposed. Also you maybe want to mask the IP you used in your question.
If you are developing locally its probably best to install a MariaDB locally on your PC (e.g. via Docker) - if you have to use that specific server you should do it over some sort of Tunnel (VPN, SSH).
I am trying to run this command locuscompare(in_fn1 = gwas_fn, in_fn2 = eqtl_fn, title1 = 'CAD GWAS', title2 = 'Coronary Artery eQTL') within R in ubuntu behind a corporate proxy
but having the following persistent issue for three days.
Error in .local(drv, ...) :
Failed to connect to database: Error: Can't connect to MySQL server on 'locuscompare-us-west-2a.xxxxxx.us-west-2.rds.amazonaws.com' (111)
Warning message:
In rm(config) : object 'config' not found
I have already tried the solutions mentioned in stack overflow, such as installing MySQL, assigning users' privilege, editing bind-address in configuration file, but still do not know how to run it smoothly.
I thought at first it was an issue related to the lacking of MySQL server and AWS account on my device. But, when I use it on my mac with home Wi-Fi, it is working like a charm without any installation and creation of MySQL server and AWS account. However, I still need to use this tool on my work PC because of input data privacy issue.
Does it mean I need to create an AWS account and adjust the network setting in it to access MySQL server on this URL 'locuscompare-us-west-2a.xxxxx.us-west-2.rds.amazonaws.com'? (Sorry that I am very new to AWS and MySQL.)
Please let me know how to run this tool behind a corporate proxy.
I have two separate Ubuntu VMs running on VirtualBox. I am getting the error "Remote DB Error: connect ECONNREFUSED". Here is some background information:
When co-located on same VM, NodeJS to MySQL works fine together. Problem only started after moving MySQL to its own VM.
VMs set up in VirtualBox as Internal Network. They have their own static IPs, and the two VMs can ping each other's IP addresses fine.
When I first got the error, the indication was that nodeJS was trying connection on port 3306 ("Error: connect ECONNREFUSED 192.168.1.69:3306"). Then, I added the port option when creating the connection object ("port : '3306'), but this did not fix problem.
Next, I saw a thread that suggested checking to see what port mySQL is listening on by running (netstat -ln | grep mysql), and the result I got back was "unix 2 [ ACC ] STREAM LISTENING 1831 /var/run/mysqld/mysqld.sock". So, since it said it was listening on 1831, I switched my port in the connection creation code to below:
qvar connection = mysql.createConnection({
host : '192.168.1.69',
port : '1831',
user : 'root',
password : 'vinson',
database : 'pilot',
stringifyObjects: 'true'
});
, however, I was still getting the same error.
UPDATE TO MY POST:
Since my first posting of this... eh.. post, I have learned some things, and in the process made some incremental progress:
By default, MySQL only listens to localhost traffic. In order to have it listen to external traffic you have to disable the listen/bind address in it's my.cnf file. So, I did that, and then restarted MySQL.
Once I did that, I ran "netstat -tlnp", a new line dsiplayed indicating something (definitely MySQL) listening on 0.0.0.0:3306, and this was not there before I made the config change and restarted MySQL.
Then, I executed a query again from the NodeJS VM, and I got a different error (hey, I'll take this as a sign of incremental progress):
" Error: Cannot enqueue Query after fatal error."
So that is where I am now. As before, I would be grateful for any ideas as to what I might try next. Thanks for any help!
Ok, I figured out the rest of my issues. The error above (Error: Cannot enqueue Query after fatal error.) was due to the fact that I had not restarted my NodeJS server, so it had the old connection object. Once I restarted NodeJS server, I then got a new error:
ER_HOST_NOT_PRIVILEGED
The reason I was getting this error was simply because, for a given user, MySQL must know the host from which that user is connecting from (since a valid connection credential for MySQL is combination userId/password/host). Once I updated my user account for remote connections with the appropriated allowed remote hosts, everything worked fine!
I've been trying to learn Node.js recently, and I now want to access a database, which I use this library for. Problem is that I want to create a database on my computer and connect to it from my node.js program, but I can't for my life figure out how this is done!
In my solution I added a SQL Server Database Project, and tried to connect using this following string:
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',
database : 'Database1'
});
But I'm getting an exception saying error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306, which is thrown by some timeout (which I figure is because of the database isn't visible or something?).
So my question is how do I set this up so I can work with data in Visual Studio, without having to rent a server to host my database?
I'm not even sure I'm using the right project-template for my database, but I cannot see any other type of it. From what I've read on the Internet I see that there usually is some other template you should use to create a database.
I really don't know what to do, so any suggestions are welcomed.
It looks like to be an issue with the port.
This might help you out:
Cannot connect to SQL Server with Node.js and Tedious
I have been trying to connect a C# WPF app with a MySQL database. The database is on a Linux machine in my network. I have a lot of experience connecting with PHP but have never done it with a .NET product. I have read through everything I have found online. I have already downloaded and installed the MySQL connect stuff and attached it to the project. I have gone into the db and made sure it would accept queries from my work PC using phpMyAdmin. I have tried a wide variety of code to call the DB. I have changed the order of everything in connStr. I have changed the labels and formatting to try everything I have come across. I am able to connect to the DB with all of the web based tools that tie to this app so I know that I have the right info. I have never posted on here so I am sorry about the formatting. Everything I have read make this sound quite straightforward. I and am currently using this:
string connStr = "user=admin;database=test;server=192.168.0.37;password=******;"; MySqlConnection conn = new MySqlConnection(connStr);
try
{
Console.WriteLine("Trying to connect to: ..." + connStr); Console.WriteLine("Connecting to MySQL...");
conn.Open();
// Perform database operations
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
conn.Close();
Console.WriteLine("Done.");
and I am getting this error:
Test.vshost.exe Error: 0 : Unable to connect to any of the specified MySQL hosts.
A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
at MySql.Data.MySqlClient.NativeDriver.Open()...
Thank you for your help on this!
When you are trying to contact a server in a home network using a basic modem/router, it can fail to recognize or pass along the port number you sent. In this case it was not recognizing or sending 3306 (default for mysql). This would make it so it would never work without SSH tunneling. After adding SSH tunneling it worked as advertised.