MySQL is connecting to a different unknown IP when trying to connect. Code Below:
.env
MYSQL_HOST=domain.example.com
MYSQL_USER=****
MYSQL_PASSWORD=****
MYSQL_DB=****
MYSQL_PORT=3306
connection.js
const mysql = require("mysql");
exports.pool = mysql.createPool({
connectionLimit: 10,
host: process.env.MYSQL_HOST,
port: process.env.MYSQL_PORT,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DB,
});
controller/cron
pool.getConnection((err, connection) => {
if (err) {
console.log("ERROR: ", err);
} else { ... insert data .... }
});
With this i'm getting error:
try connecting to remote mysql...
Error: Error: ER_ACCESS_DENIED_ERROR: Access denied for user '****'@'112.200.198.66' (using password: YES)
Tested in MySQL Workbench and successfully connected. I'm just curious where the IP came from when the public IP of that domain is different. Also tried using the IP instead to connect and still giving me the same error.