Hi,
I'm trying to get a connection to a server but it sends the login credendtials with the wrong host as soon as host contains a '.' in it and falls back to localhost
so when I try this:
var db = mysql.createConnection({
user: 'web84_9',
password: 'MyPassword',
host: 'server5.webgo24.de',
database: 'web84_db9',
debug: 'true',
});
db.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}console.log('connected as id ' + connection.threadId);
});
I get
message: 'Access denied for user \'web84_9\'@\'rasalhague.uberspace.de\' (using password: YES)' }
(rasalhague.uberspace.de is the local host name)
and when I change the host to something like "server5" i get the expected confused message.
It shows \'web84_9\'@\'localhost\' when I change the host to localhost
I want to login as [email protected] ... I don't know if this is a bug or not or how to do it, maybe I'm missing some fundamental knowledge about MySQL... If so pls explain :-)
Try adding 'https://' to your host
ie host: 'https://server5.webgo24.de',
I tried it but now I get
getaddrinfo ENOTFOUND https://server5.webgo24.de https://server5.webgo24.de:3306
Hi @Rhapsody-Sky I think you're misunderstanding how MySQL grants work. For example, the error you're getting Access denied for user 'web84_9'@'rasalhague.uberspace.de' (using password: YES) is being generated by your MySQL server, not this module. The format is '<username>'@'<machine_you_connected_from>'. By default MySQL server will do a reverse DNS lookup of the IP address the connection came from and put that DNS name there if there is one. rasalhague.uberspace.de should be the name of the machine you connected from, not the name of the MySQL server, for how MySQL server works.
I hope this helps.
Most helpful comment
Hi @Rhapsody-Sky I think you're misunderstanding how MySQL grants work. For example, the error you're getting
Access denied for user 'web84_9'@'rasalhague.uberspace.de' (using password: YES)is being generated by your MySQL server, not this module. The format is'<username>'@'<machine_you_connected_from>'. By default MySQL server will do a reverse DNS lookup of the IP address the connection came from and put that DNS name there if there is one.rasalhague.uberspace.deshould be the name of the machine you connected from, not the name of the MySQL server, for how MySQL server works.I hope this helps.