Err access denied, not sure what else to try
See original GitHub issueHello, I’m using mysql
in my node app and I"m not sure how to get past this error:
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlMessage:
'Access denied for user \'magento\'@\'me.localtestdomain\' (using password: YES)',
sqlState: '28000',
fatal: true
On the target machine (remote machine), I’m able to connect using mysql workbench without issues. I can even connect using mysql
with the port being a ssh-tunnel no problem. But i get that error above when i try to connect straight like I’m doing in mysql workbench. Given i can connect using mysql workbench without ssh, the machine is listening on all interfaces. I have the config set to bind 0.0.0.0
.
As root if i run mysql> SHOW GRANTS FOR 'magento'@'%';
, i get:
+----------------------------------------------------------------+
| Grants for magento@% |
+----------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'magento'@'%' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `database`.`magento` TO 'magento'@'%' |
+----------------------------------------------------------------+
2 rows in set (0.00 sec)
Not sure how to remove the second line, but the first line should be enough to get me back working (unless i’m wrong). I’ve ran mysql> FLUSH PRIVILEGES;
, manually restarted mysql with systemctl restart mysql.service
and even rebooted the remote server. I’m still unable to get this module working for a direct connection.
Partial script
const connectionParameters = () => {
return mysql.createConnection({
host: <remote ip>,
port: 3306,
user: 'magento',
password: 'password',
database: 'magento'
});
};
let connection = connectionParameters();
// connection.connect();
connection.connect(function (err) {
if (err) {
console.log(err);
console.log('Error', err.code) // 'ECONNREFUSED'
console.log('Error', err.sqlMessage)
console.log'Fatal', err.fatal)
}
})
let query = 'SELECT * FROM core_config_data';
connection.query(query, function (error, results, fields) {
if (error) return reject(error);
console.log(JSON.stringify(results, null, 2))
});
connection.end();
It’s Ubuntu 18.04 LTS, ufw has allow on port 3306. I’m lost. Looked at similar issues and the people that opened the tickets often didn’t reply or didn’t give the information requested while you all were trying to help. Hopefully you will be able t help me. I’ve provided details above and can provide more.
Any ideas on what to do?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
@travis5491811, that’s strange. can you login into the server as root and deleting the user from mysql, re-create them, grant privileges and flush privileges?
Umm, that worked. Not sure why but ok.