The problem is simple, but i dont know if the think i am doing is wrong, i will try to explain it and if some knows how to solve it wold be cool and i will thank you so much.
remember that this app is made whit NextJS
DotEnv variables are in a .env file that is in the root folder of my NextJs app.
I have this data base connection where i am using DotEnv variables:
** UPDATE **
i am not destructuring more the data according to the NextJs documentation, and now my .env is .env.local and still not working, if someone knows why it is not working you are free to comment.
const db = mysql({
config: {
host: process.env.MYSQL_HOST ,
port: process.env.MYSQL_PORT ,
database: process.env.MYSQL_DATABASE ,
user: process.env.MYSQL_USER ,
password: process.env.MYSQL_PASSWORD
}
});
by this way it is supposed to connect but it give me an access error to the database, but when i place the data like this without DotEnv.
const db = mysql({
config: {
host: "127.0.0.1" ,
port: 3306 ,
database: "mydatabase" ,
user: "myuser" ,
password: "123"
}
});
the connection works fine. may be its the way i am declarating my .env file ore somthing, if you know what am I doing wrong I would be glad to know. thaks for reading.