Jump to content

No DB connection


TheMindFlayer

Recommended Posts

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
Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...