TheMindFlayer

No DB connection

Recommended Posts

Posted (edited)

Hello, I have a problem with my DB connection.

I installed Rage MP and put this code where it belongs(link is attached to this message) but I have a problem with the connection. It seems like there's none. I've tried to connect to the same DB using diffirent code on my other project and it works just fine. Checked the firewall and it seems like everything is okay. Any ideas or suggestions? All the code is in the link below. And suggestions will be appreciated, thanks!

 

Even the console log isn't showed in the server window.

Here is the code:

Spoiler

 

module.exports =
{
handle: null,

 

connect: function(call){
this.handle = mysql.createConnection({
host : '185.bla bla',
user : 'Bla user',
password : 'bla bla password',
database : 'bla db'
});

 

this.handle.connect(function (err){
if(err){
switch(err.code){
case "ECONNREFUSED":
console.log("\x1b[93m[MySQL] \x1b[97mError: Check your connection details (packages/mysql/mysql.js) or make sure your MySQL server is running. \x1b[39m");
break;
case "ER_BAD_DB_ERROR":
console.log("\x1b[91m[MySQL] \x1b[97mError: The database name you've entered does not exist. \x1b[39m");
break;
case "ER_ACCESS_DENIED_ERROR":
console.log("\x1b[91m[MySQL] \x1b[97mError: Check your MySQL username and password and make sure they're correct. \x1b[39m");
break;
case "ENOENT":
console.log("\x1b[91m[MySQL] \x1b[97mError: There is no internet connection. Check your connection and try again. \x1b[39m");
break;
default:
console.log("\x1b[91m[MySQL] \x1b[97mError: " + err.code + " \x1b[39m");
break;
}
} else {
console.log("\x1b[92m[MySQL] \x1b[97mConnected Successfully \x1b[39m");
}
});
}
};

 

Edited by TheMindFlayer

Share this post


Link to post
Share on other sites

Same problem...
local works fine, but if i connect to another server it does not work anymore.

If I run the sql file with node, the connection is instantly established, but with the rage server it doesnt work.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.