#mysql #node.js #phpmyadmin
Вопрос:
Я создал пул для подключения к базе данных phpmyadmin, но ему отказано в доступе
const pool = mysql.createPool({
host: process.env.hostsql,
user: process.env.user,
password: process.env.password,
database: process.env.database,
});
я попытался соединить его
event.js
function routes(pool) {
const eventRouter = express.Router();
eventRouter.get('/event', (req, res) => {
pool.getConnection((err, connection) => {
if (err) throw err;
debug(`connected as id ${connection.threadId}`);
connection.query('SELECT * from event', (rows) => {
connection.release(); // return the connection to pool
if (!err) {
res.send(JSON.stringify(rows));
} else {
debug(err);
}
// if(err) throw err
debug('The data from beer table are: n', JSON.stringify(rows));
});
});
});
return eventRouter;
}
module.exports = routes;
Я получил эту ошибку, и я должен проверить, правильны ли мои учетные данные базы данных
at Handshake.Sequence._packetToError (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
--------------------
at Protocol._enqueue (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at PoolConnection.connect (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/Connection.js:116:18)
at Pool.getConnection (/home/rou-technology/NODE JS/oesc/node_modules/mysql/lib/Pool.js:48:16)
at /home/rou-technology/NODE JS/oesc/routes/event.js:8:10
at Layer.handle [as handle_request] (/home/rou-technology/NODE JS/oesc/node_modules/express/lib/router/layer.js:95:5)
at next (/home/rou-technology/NODE JS/oesc/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/rou-technology/NODE JS/oesc/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/rou-technology/NODE JS/oesc/node_modules/express/lib/router/layer.js:95:5)
at /home/rou-technology/NODE JS/oesc/node_modules/express/lib/router/index.js:281:22 {
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlMessage: "Access denied for user 'ondoed4t_oecs_user'@'102.89.2.29' (using password: YES)",
sqlState: '28000',
fatal: true
пожалуйста, что я могу сделать, phpmyadmin размещен онлайн в панели управления