Access Denied For user

Problem

Description
The issue that I am currently facing can be described with an error telling me that access has been denied to one of my mySQL Databases that I have set up with InfinityFree. I have tried many solutions which can be found on the forum but unfortunately none of the solutions seemed to fulfill my specific issue.

Code

// Set Up Our MySQL Connections

const connection = mySQL.createConnection({
    host: 'oceanicairlines.rf.gd',
    user: 'epiz_26138384',
    password: '***************',
    database: 'epiz_26138384_oceanicairlines'
});

connection.query('SELECT * FROM users WHERE 1', (err,rows,fields) => {
    if (err) throw err;
    console.log(rows);
});

Error

Error: connect ECONNREFUSED 185.27.134.133:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
    --------------------
    at Protocol._enqueue (C:\Users\*****\Documents\Oceanic Airlines Bot\node_modules\mysql\lib\protocol\Protocol.js:144:48)
    at Protocol.handshake (C:\Users\*****\Documents\Oceanic Airlines Bot\node_modules\mysql\lib\protocol\Protocol.js:51:23)
    at Connection.connect (C:\Users\*****\Documents\Oceanic Airlines Bot\node_modules\mysql\lib\Connection.js:116:18)
    at Connection._implyConnect (C:\Users\*****\Documents\Oceanic Airlines Bot\node_modules\mysql\lib\Connection.js:454:10)
    at Connection.query (C:\Users\*****\Documents\Oceanic Airlines Bot\node_modules\mysql\lib\Connection.js:196:8)
    at Object.<anonymous> (C:\Users\*****\Documents\Oceanic Airlines Bot\index.js:21:12)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '185.27.134.133',
  port: 3306,
  fatal: true
}

Solutions

My Attempts

Attempt #1
With my first attempt at fixing the problem, I tried to change the user and password to the username and password of my InfinityFree account. This idea was sparked by this post which describes how someone was using the incorrect username and password.

Attempt #2
I also tried to change the host to sql300.epizy.com, which is what it says in the client area (I think that’s what it is called?) for MySQL Hostname, thinking they would correspond to each other.

Results

Unfortunately, with my luck in code debugging, none of them worked. That is why I am calling out to the forums, as I see in other posts that most of the time, the issues are solved.

Additional Information

Additional Information

My Coding Interface

I am using Visual Studio Code to make a Discord bot for my fictional airline. The current dependency that I am using for this is ‘mysql’, running version 2.18.1. The whole thing is written in JavaScript. If it helps, here is a list of all my dependencies, in JSON format:

"dependencies": {

    "body-parser": "^1.19.0",

    "discord.js": "^12.2.0",

    "express": "^4.17.1",

    "morgan": "^1.10.0",

    "mysql": "^2.18.1"

  }

New User

I am a new user and had just joined today. I apologize if I am using an incorrect format for these forums, I have been to many other types of Discourse Forums and usually when I post on them, I use this type of format. Please let me know if I need to change something; help would be greatly appreciated.

Since I am a new user, I am used to remotemysql.com to access my mySQL Databases, however I am switching because this has more data that I can put in the databases. When I was using that site, everything worked fine, so I am not sure if I am transferring a habit which is only for it over to here, or if I am just missing something.

Thank you for taking time to read my post, and I hope to hear back.

Hello there,

This is quite a detailed post! Kudos!

Also as what I’m understanding here is that you’re trying to create and connect to a MySQL database for your discord bot or a discord application? Is that true?

Well if that’s the case and also since you are using remotemysql as what you mentioned then it won’t work. Remote MySQL for external applications or sites are not supported here unfortunately, the free MySQL databases are only for websites hosted here on InfinityFree.

You may refer to this Knowledge Base article for more info:

6 Likes

Thanks for your reply! And, thanks for getting back to me so quickly! I found out the issue, was that I need to transfer everything from my Visual Studio Code environment to my hosting account, I was a little confused. The article helps me a lot, I will test it then get back to you shortly.

In addition to what @UnknownLolz said, please note that we only support PHP as a server side language on our hosting. So a Node.js script can’t be executed on our servers. And code that isn’t running on our servers can’t access our databases.

5 Likes

I took both of those ideas into thought, and figured out that I’ll just need to improve my PHP if I cannot access this from an outside source. Thank you all for your help!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.