Currently, I am using dialogflow for creating a chatbot. I am using in WordPress site. But when I am trying to write any data from the chatbot to the WordPress MySQL server or read any data there I am getting this issue ‘connect ECONNREFUSED 127.0.0.1:3306‘.
Currently, I am using dialogflow for creating a chatbot. I am using in WordPress site. But when I am trying to write any data from the chatbot to the WordPress MySQL server or read any data there I am getting this issue ‘connect ECONNREFUSED 127.0.0.1:3306‘.
This is the code that I am using to connect the MySQL server.
**`
function connectToDatabase(){
console.log('in start the MySQL server.');
const connection = mysql.createConnection({
host : '127.0.0.1:3306',
user : 'u975275493_XXXX',
password : '*******',
database : 'u975275493'
});
console.log('MySQL server details:',connection);
return connection.connect((err) => {
if (err) return console.error(err.message);
console.log('Connected to the MySQL server.');
});
}`**
Can anyone help me to identify the problem and please suggest the way to connect the DialogFlow chatbot to WordPress DB.
RE TECHMART is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.