I am acually remaking a wordpress site from scratch with React (for frontend) , Node and express (for backend). There are a lot of post on the current wordpress site database and i want to use the same database and will just use Node and express to create, read, update or delete posts. I see the phpmyadmin panel but there is a big mess (3 database and 20+ tables on each database and a lot of entry on each table) of data and i don’t know where is the real post and what should i do now. I try this code to connect with the database
const mysql = require('mysql');
const connection = mysql.createConnection({
host: 'localhost',
user: 'user_name',
password: 'password',
database: 'database name'
});
connection.connect((err) => {
if (err) {
console.error('Error connecting to the database:', err);
return;
}
console.log('Connected to the database');
});
module.exports = connection;
when i run this code this give me a error
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'my_user_name'@'localhost' (using password: YES)
i am getting all the connection data(user, password, database, host) from wordpress file manager wp-config.php and now don’t know how to make the backend with node.
Please anyone know what to do next help me to create the backend๐๐๐
2
Answers
I figure it out. You just have to give you're remote host name which you'll find on cpanel and you have to add you're local ip adress to the remote mysql host.
try this approach