Kind Request before marking it as duplicate read full question.
Error :- 'Access denied for user 'Test_UG'@'88.81.84.184' (using password: YES)', code: 'ER_ACCESS_DENIED_ERROR', errno: 1045, sqlState: '28000', stack: 'Error: Access denied for user 'Test_UG'@'88.…Trampoline (node:internal/async_hooks:130:17)'
Software/Application/Program used for – Visual Code, Node.js, PHP, MySQL
Hosting Used – Go daddy, Cpanel
Purpose of Program – Making Telegram Bot, MySQL being used for storing data
Was it working on Local Machine ? – Yes it was working on local machine using Wamp Server.
Change made – only changed MySQL connection details
Solution tried – Tested with full access new DB, User & Password, also tested with old user which is created 2-3 days ago. Tried many solutions from stack overflow few of them are below
MySQL: Access denied for user 'test'@'localhost' (using password: YES) except root user
Access denied for user 'test'@'ip'(using password: YES)
Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?
Node.js code –
// Create a MySQL pool
const dbConnect =({
host: 'xyz.com',
user: 'Test_UG',
password: 'Xyz@1122!',
database: 'xyz_bot',
});
// Function to store user messages in the database
async function storeMsg(msg) {
const connection = await mysql.createConnection(dbConnect);
try {
await connection.execute('INSERT INTO chat_details (username, user_id, msg_date, token_name, token_amount, msg) VALUES (?, ?, NOW(), ?, ?, ?)',
[msg.from.username, msg.chat.id, getRandomToken(), getTokenAmount(0.001, 0.2), msg.text]);
console.log('User message stored in the database.');
} catch (error) {
console.error('Database error:', error);
} finally {
connection.end();
}
}
I connected with Go Daddy technical support team they gave below solution...
Go to --> CPannel --> Database --> Remote MySQL
Input your IP address/localhost address in my case it is 88.81.84.184
and click on Add Host.
It take 5 to 90 min update.